S&P, Nasdaq edge higher as earnings offset trade fears, world stocks fall