The S&P 500 and Dow erased most losses while the Nasdaq turned positive in late morning on Thursday as investors saw recent weakness in the market as a buying opportunity.

The Dow Jones industrial average <.DJI> was down 21.91 points, or 0.18 percent, at 12,217.98. The Standard & Poor's 500 Index <.SPX> was down 0.53 point, or 0.04 percent, at 1,320.35, after briefly turning positive.

The Nasdaq Composite Index <.IXIC> was up 0.19 point, or 0.01 percent, at 2,789.26.

(Reporting by Caroline Valetkevitch; Editing by Kenneth Barry)