Hi,
I'll need you to answer some more Qs.
1. Does your PSR have it's own sequencer or an arranger function turned on? If so , than you will have to disable that feature for now. Or simply find an option on your PSR that will allow you to sync the sequencer/arranger clock to MIDI (IE clock of the sequencer program).
Another way to approach this is to check out some options in Sonar that deal with Synchronization and things like MIDI clock etc. It might be that as a default setting Sonar is set to scan for external MIDI clock sources and if detected it automatically syncs to them or attempts to and since PSR is probably sending clock messages it ends up sending it in a loop thus the whole thing gets warped.
Functions like "MIDI thru" allow to basically use controllers and synths without "LOcal Control on/off" switch and mainly addresses stuff like note on off events, controllers, aftertouch, pitch bend etc. But weather you have it enabled or disabled doesn't at all affect MIDI synchronization and all the confusion and chaos it can bring if not setup properly.
THis is just a guess since I have not used any PSR keys but some of my workstation keyboards have internal sequencers and thus are capable of generating MIDI clock and other forms of synchronization messages. When used with software sequencers without everything being setup properly (such as internal sequencer disabled, MIDI clock set to External or MIDI and so on) it can pretty much create problems that you are experiencing. NOtes hanging or just dropping out. Abnoxious control messages firing at random so on.
If all of the above doesn't get you anywhere than you may want to try using Sonar with some other MIDI keyboard. Just to test everything and see if it's the PSR that's causing all the problems. In general cheaper arranger KBs aren't really made with MIDI in mind and even though most or all feature MIDI in some form it's not really good enough for work with professional MIDI sequencers and programs like Sonar. It should be usable nevertheless though so at least you should be getting a decent flow of MIDI note on/off events without any nasty problems that you're having.
But on the other hand I wouldn't be surprised that it's the PSR that is messing it all up.
Okay good luck.
-ED-
_________________________
A gentleman is one who never hurts anyone's feelings unintentionally.
- - - Oscar Wilde