* S&P 500 has been unable to close at a record this week
* Target and Lowe's rally after results
* Jan new home sales surge past forecasts
* Indexes up: Dow 0.2 pct, S&P 0.1 pct, Nasdaq 0.3 pct
U.S. stocks were mostly flat on Wednesday as, for a third straight session, equities were unable to hold onto gains that took the S&P 500 near record levels.
Stocks opened higher but pared gains almost immediately despite some positive housing data and strong results from retailers Target Corp and Lowe's Cos Inc. The S&P's record has been serving as a resistance level, with traders finding few reasons to push indexes out of their recent trading range. The index is less than 1 percent below its all-time high.
In a positive sign, new home sales surged to a 5-1/2-year high in January, far outpacing expectations. While much recent data has been below forecasts, analysts have pinned that to bad weather rather than worsening fundamentals. The housing data could support that theory.
"The vast majority of recent weakness has been related to weather, with the Northeast paralyzed and stores horrible as a result, while we continue to see strength in areas that weren't impacted," said Eric Green, senior portfolio manager and director of research at Penn Capital Management in Philadelphia.
"I don't think the economy's strength differs too much from state to state, so confidence should continue to come back to the market."
Target rose 5 percent to $59.36 after reporting its results, even as the retailer said the sales and earnings had been impacted by a massive data breach and that costs relating to the event could hurt future profits.
Lowe's rose 5.3 percent to $50.69 after the home improvement retailer reported earnings and sales growth and an additional stock buyback program of $5 billion. The results come a day after peer Home Depot also posted strong earnings.
The S&P retail index rose 1.5 percent.
The Dow Jones industrial average was up 27.93 points, or 0.17 percent, at 16,207.59. The Standard & Poor's 500 Index was up 2.08 points, or 0.11 percent, at 1,847.20. The Nasdaq Composite Index was up 11.94 points, or 0.28 percent, at 4,299.53.
Market moves may be slight until Thursday, when Federal Reserve Chair Janet Yellen addresses the Senate Banking Committee in a semi-annual testimony about monetary policy. Her comments will be scoured for insight into the extent to which an unexpectedly cold winter has impacted economic activity, and for confirmation the Fed will maintain its stimulus-trimming schedule.
Both Chesapeake Energy Corp and First Solar Inc fell after posting declines in earnings. First Solar fell 10 percent to $52.21 a day after the solar panel maker reported that its fourth-quarter net income fell 58 percent. Chesapeake fell 7.7 percent to $24.86 after it swung to a net loss on charges related to employee termination costs.
Dollar Tree Inc rose 4.3 percent to $54.97 after giving a full-year profit outlook.
Anika Therapeutics Inc soared 48 percent to $51.28 a day after it said the Food and Drug Administration had approved its drug to treat pain and improve joint mobility in patients with osteoarthritis of the knee, more than four years after it first filed for approval.