pinguinotuerto
The offset between the MIDI and the audio amounts to the round-trip latency reported to Sonar by the audio device.
Audio latency will not make your MIDI land early in the timeline, it will make it late, and it will be by the outbound audio latency only plus inbound MIDI transmission delay; this might happen to be close to audio RTL in a lot of cases, but that's just coincidence.
There will be a tendency for the performer to compensate for the combined audio and MIDI latency by playing early, but that's usually just a few milliseconds, and just makes up for the latency; there shouldn't be significant overcompensation. The exact result will depend on whether you're input monitoring or direct monitoring hardware synths driven by local control or echoed MIDI, or playing soft synths.
In any case, the OP and others have mentioned errors of 30 milliseconds or more (I recall seeing 75ms in one thread); that's much higher than any typical audio or MIDI transmission latency could account for, regardless of the direction. What you're doing may be working for you, but it's not going to be the right amount of nudge for everyone, and it should not be necessary with properly configured and working interfaces and drivers running at playable latencies.