the 1099S is for 2017, I would report the sale 2017. the situation you present is the same as if you got a check dated 12/29/17 but you cashed it in January.