I don't see any purpose in putting your format string in a variable, and I suggest you use snprintf() rather than sprintf(), but otherwise you got the right idea. However, allowing 1000 bytes for the output string seems rather excessive, and given that the common Arduinos only have a total of 2KB of memory it may be more than you can afford.