Cash-strapped shoppers shunned apparel and other discretionary purchases in March, stocking up instead on groceries and other basics at discounters like Wal-Mart as the economy swooned.

With food and energy prices soaring, home prices falling, the jobs market deteriorating and a credit crisis threatening further damage to the stock market, clothing is increasingly out of fashion with middle-market consumers.

J.C. Penney reported a 12 percent drop in its same-store sales, or sales at stores open at least a year, as the chain’s CEO said he doesn’t expect the shopping environment to improve anytime soon. Gap’s same-store sales plunged 18 percent amid dwindling store traffic, although it kept its profit outlook intact, citing tightly controlled inventory.

Collectively in March, retailers posted a 0.5 percent drop in same-store sales, according to an index of 37 major chains compiled by the International Council of Shopping Centers. That’s the worst showing for March in 13 years, said Michael Niemira, the trade group’s chief economist.

The ugly number was fueled in part by an unusually early Easter and cold weather that hurt demand for spring fashions..

Despite the lackluster results, retail shares posted a broad rally, as many investors had braced for steeper declines and more numerous profit warnings. Kohl’s, which reported a whopping 16 percent same-store sales drop, saw its shares rise $1.32, or 3.1 percent, to $43.72.

Same-store sales at Saks fell 2.9 percent, while they rose just 0.4 percent at Neiman Marcus. Though tourists lured by a weak dollar are continuing to fuel luxury sales in Manhattan, stores like Saks Fifth Avenue have been staging more shopping events and promotions to prop up their business, said Faith Hope Consolo, chairman of retail leasing and sales at Prudential Douglas Elliman.

Even if you’re filthy rich, “you can’t hear so much negative news and not get caught up in it,” Consolo said.