The generally accepted practice is to select standy while changing digits. This is to prevent inadvertent selection of another code (which can cause false identification of flights which are not yet airborne) or the accidental selection of one of the emergency codes on the way past.
Having said that, the advent of push-button transponders in some light aircraft are beginning to make this obsolete as when you start entering another code it seems to stop squawking all by itself until all four digits are in.
If you want a fuller reply, then do a search on this subject and you will see a longer discussion.