FORT WORTH, Texas — D.R. Horton Inc., the nation's largest homebuilder, said it swung to a loss in the last three months of 2007, hurt by hefty charges to write down inventory and declining land values.

Amid a housing slump, cancellation rates remained high and pushed down sales orders 52 percent from a year ago. In the nation's biggest market, California, Horton's sales orders fell 72 percent. Orders tumbled 65 percent in Colorado, Illinois, Minnesota and Wisconsin, and 56 percent in New Jersey, North Carolina and Pennsylvania. They fell 59 percent in Arizona, New Mexico and Utah.

"I don't see a recovery in California in the next 12 months," said Chief Executive Donald J. Tomnitz.

Horton's losses in the quarter that ended Dec. 31 totaled $128.8 million, or 41 cents per share, compared with profit of $109.7 million, or 35 cents, a year earlier, the company said Thursday. The most recent quarter, the first in Horton's new fiscal year, included $245.5 million in pretax charges to write down inventory and the value of land deposits.

Revenue plunged to $1.71 billion from $2.8 billion a year ago. The builder closed on 6,549 homes, down sharply from 10,202 a year earlier.

Analysts surveyed by Thomson Financial expected a loss of 25 cents per share on revenue of $1.62 billion.

D.R. Horton said its sales order backlog of homes under contract stood at 8,138 homes, or $2.0 billion, as of Dec. 31, compared with 16,694 homes, or $4.7 billion, a year earlier. The cancellation rate for the first quarter was 44 percent, down from 48 percent in the previous quarter.

"Market conditions remained challenging in our December quarter as inventory levels of both new and existing homes remained high while pricing remained very competitive," said Donald R. Horton, chairman, in a statement.

He said lending standards remained restrictive and buyers viewed home buying cautiously. He expects the housing environment to remain challenging.

The company's 2008 goal is to generate at least $1 billion in cash flow from operations. In the first quarter it generated more than $550 million in cash flow from operations, mainly driven by $476 million from the reduction of inventories.

Company officials said they would continue to cut prices or give buyers incentives to meet sales goals. They said the toughest markets included California, Las Vegas, Arizona, and Florida. The sales decline was a more modest 18 percent in the south-central states.

Banc of America Securities analyst Daniel Oppenheim said Horton's write-downs were more modest compared with other builders in the same quarter. That was because the company had conservatively assumed that sales and home prices would keep weakening.

Horton has taken $1.8 billion in cumulative write-downs. Oppenheim predicted the company will take further write-downs of $1.2 billion.