Stata command to rename groups of variables

Swap variable names: rename (v1 v2) (v2 v1)

Lowercase (or uppercase, or propercase) groups of variable names: rename V1 V2, lower or rename *, lower

Add suffix _old to variables v1, v2, … for one or more digits: rename v# =_old

Remove suffix _old from all variables ending in _old: rename *_old *

The meaning of each specifier:

 

This entry was posted in Stata and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *