Stocks shrug off patchy data; gold set for first weekly loss of 2024