It sees that it is there but doesn't pick up the noise.
MIDI does not have any "noise." It is a control code that can be used to operate a hardware or software synth. Unless your "other program" is a softsynth or a host for a softsynth, and properly set up to route the message to a softsynth, there will be no sound produced. The MIDI data sent from your keyboard will be the same data as the midi data recorded in Sonar from the keyboard. I do not see what you gain from routing MIDI keyboard > Sonar > "other program" that could not be done better by skipping Sonar unless your "other program" is unable to connect to the keyboard output. If that is the case, then there are much less demanding programs you could use to route a midi file to your "other program" in real time than Sonar. Do a google search for "MIDI virtual cable."
If you can tell us what your "other program" is, and what your operating system and version of Sonar etc. are you might find someone who can be more specifically helpful.