Stocks rose for a second day on Thursday, but mixed economic data kept confidence in the recovery on shaky ground even as LinkedIn's shares surged in the company's Wall Street debut.

Stocks have shown signs of resilience after falling 1.5 percent so far this month as many investors resign themselves to a patch of economic weakness over the summer.

My bottom line, at least over the summer, is I that think there is enough valuation cushion to withstand a slowing of economic growth, so I think we have a cyclical slowing priced in, said Jack Ablin, chief investment officer, Harris Private Bank in Chicago.

Economic data painted a cloudy picture as slowing factory activity in the mid-Atlantic region and falling sales of existing homes offset weekly jobless claims that suggested the labor market was on track for recovery.

Shares of LinkedIn Corp , the social network company, more than doubled their IPO price in a jump reminiscent of the heyday of investors' love affair with Internet stocks.

The stock rocketed to an intraday high of $121.97 -- or as much as 171 percent above its initial offering price of $45.

The Dow Jones industrial average <.DJI> gained 43.10 points, or 0.34 percent, to 12,603.28. The Standard & Poor's 500 Index <.SPX> gained 2.22 points, or 0.17 percent, to 1,342.90. The Nasdaq Composite Index <.IXIC> gained 9.45 points, or 0.34 percent, to 2,824.45.

Semiconductor shares fell after Goldman Sachs cut its rating on Intel Corp , citing slowing processor shipments, rising competition and record capital expenditure levels this year. The firm also lowered its rating on Applied Materials as part of a wider downgrade on the semiconductor equipment sector.

Intel shares lost 1.8 percent to $23.45 and Applied Materials dropped 1.7 percent to $14.25. The PHLX semiconductor index <.SOX> declined 1 percent.

Stocks, bonds, gold and the euro are expected to fall in the three months after the end of the Fed's second massive bond-buying operation, also known as quantitative easing, or QE2, a Reuters poll of 64 analysts and fund managers found on Thursday.

(Editing by Kenneth Barry)