Look at your 'My Documents' folder.. there should be an 'EA Games' folder. That folder contain all installed EA Games' saved games (Sims 2, in this case). Just copy this folder somewhere save, and simply copy it back to your new 'My Documents' folder after reinstalling operating system.
Note that if you only reinstall The Sims 2 (not reinstalling windows), this won't be necessary, since by default you will still have your old neighborhood after the reinstall. However, it is advisable to make regular backup of this folder to avoid having to start from scratch should anything happen to your system.