In reply to Toby Dunn.

Thanks Toby! I admit it: I don't know how to "think" like the regex parser -- clearly, you have a gift.

Your suggested improvement left out the underscore as a possible starting character, but this fixes it, I think:

prxmatch('/^[a-z_]\w{0,31}$/i', Var);

Also, you make a good point about calling PrxParse too many times. The usual pattern I've seen in SAS is to run that statement only IF _N_ = 1 and then RETAIN the "re" result from the parse operation for use in subsequent observations.