My understanding is that the transponder will just output whatever the encoder says, so its more likely to be the encoder rather than the transponder.
The encoder outputs an ASCII code across its pins (see
http://www.airsport-corp.com/modecascii.txt ).
So firstly I'd check for a loose cable!
However if its varying constantly, rather than jumping between two levels (which could suggest the dodgy cable), I suggest there is a problem with the encoder itself. That sort of variance is probably more than a dodgy static connection would bring. I suspect a new encoder is in order.
Please note though - I've not yet even got a PPL so I'm not a reliable source of info!