A couple of solutions. Install loopbmidi and assign your midi tracks to it. It is a free virtual midi port utility and will show up in your midi devices. I use it all the time - it will not affect your system at all. You never need worry about connecting a device then.
http://www.tobias-erichsen.de/software/loopmidi.html You could just insert a soft synth, assign the midi tracks to it, then use the power button or drop down menu to disconnect the synth, but leave it in the synth rack. Sonar will not ask you to reassign any tracks assigned to it even though it is disconnected.
I use an m-audio uno on my portable rig if you just need a single hardware midi in/ out. Works fine and about $40