Walgreen Co posted better margins for its second quarter by carefully managing seasonal merchandise, helping investors to shrug off disappointing earnings and sending its shares up.

Walgreen's prescription and general merchandise sales were both pressured by the mild winter flu season, and consumers continued to hold off buying discretionary items.

As much as the early flu season helped our first quarter results, it hurt our second quarter results, Chief Executive Greg Wasson said in a statement.

But investors were pleased with the overall results, which came after three disappointing months of sales. The numbers were roughly in-line with depressed expectations, with better-than-expected gross margins, Raymond James analyst John Ransom said in a research note.

Meanwhile, CVS Caremark Corp Chairman and CEO Tom Ryan told investors at a Barclays Capital conference that his company continues to outperform our peers in retail. CVS also reiterated that problems at its pharmacy benefits management unit have been fixed.

The CEOs of Walgreen and CVS both said they should benefit from the healthcare reform bill approved in Washington that extends health insurance to 32 million more Americans.

Generally, CVS's Ryan said, health reform is positive for our company. You're going to get coverage. When people have coverage, it's a benefit for us.

Wasson is also examining how the bill will impact Walgreen as an employer of 238,000 people, as well as its retirees.

Walgreen shares rose 1.1 percent to $35.71 Shares of No. 2 drugstore chain CVS climbed 1.9 percent to $35.83 and shares of No. 3 player Rite Aid Corp rose 1.2 percent to $1.66.

PROFIT AND SALES MISS EXPECTATIONS

Profit was up to $669 million, or 68 cents per share, in Walgreen's second quarter ended on February 28 from $640 million, or 65 cents per share, a year earlier. The latest quarter included 2 cents per share in restructuring and other costs.

Sales rose 3.1 percent to $17 billion.

Analysts, on average, expected Walgreen to earn 71 cents per share on $17.17 billion in revenue, according to Thomson Reuters I/B/E/S.

Sales at stores open at least a year fell 0.2 percent. Same-store sales of general merchandise fell 1.6 percent while same-store prescription sales rose 0.6 percent.

Margins improved as the company stocked fewer seasonal goods, such as Christmas decorations or Valentine's Day gifts, and was not forced to mark them down to the same extent as a year ago. Gross profit margins increased 0.5 percentage point to 28.8 as a percentage of sales.

STORE OVERHAUL

Walgreen is updating its network of 7,180 stores and promoting services such as in-store and worksite clinics to drive growth. It plans to buy New York-based drugstore Duane Reade to take the top spot in New York City.

Walgreen has its new store format in nearly 700 locations and expects to have it in as many as 3,000 stores by the end of the fall. Duane Reade is also busy updating its own stores.

While Wasson is pleased with Walgreen's store overhaul there are still kinks to work out, he said during a call.

Walgreen shed $500 million worth of inventory, which cut costs but also meant that some consumers could not find goods such as tools. So Walgreen is adding back a few hundred items.

Wasson also hopes to see a sales lift from tweaks such as stocking razors near toothbrushes, as shoppers buying one item might pick up another to complement their morning routines. The chain also aims to bring the number of stores selling wine and beer up to 5,000 from more than 2,500 this year, he said.

If Walgreen could increase, even slightly, the amount that shoppers buy in its stores it would have a major impact on the bottom line. Getting each shopper to buy about one more item, bringing the average number of items purchased to four, would double Walgreen's profitability, Chief Financial Officer Wade Miquelon told investors in January.

(Reporting by Jessica Wohl, additional reporting by Lewis Krauskopf; Editing by Michele Gershberg, Lisa Von Ahn, Dave Zimmerman and Gunna Dickson)