Stocks wavered on Wall Street in afternoon trading Thursday, as gains in tech companies and retailers helped temper losses elsewhere in the market.