*# var # {cmd:rename sequence} - Rename a series of variables that share a prefix # help *! 29aug2007 program renseq version 8.2 syntax namelist(min=1 max=2) , SUFfix(namelist) [Keep] gettoken origpre newpre: namelist if mi("`newpre'") local newpre `origpre' capture unab vars: `origpre'* if _rc { display "{text: No} {res:`origpre'} {text:variables to rename}" exit } local i 0 foreach v of local vars { local ++i display "{txt: `v'} " _continue local end `:word `i' of `suffix'' if ~mi("`end'") { rename `v' `newpre'`end' display "{res:`newpre'`end'}" } else if mi("`keep'") { drop `v' display "{text:dropped}" } else display "{text:kept}" } end