*# var # {cmd:rename any} - Set a single new name (or prefix) for a set of potentially occurring names (or prefixes) # help *! 29aug2007 program renany version 8.2 syntax namelist(min=1), To(name) [First PREfix] local prefix =~mi("`prefix'") local tot 0 foreach v in `namelist' { if (`prefix') capture unab vars: `v'* else capture confirm var `v' local tot =`tot'+~_rc if (mi("`found'") & _rc==0) local found `v' } if (`tot'>1 & mi("`first'")) mata: errel("More than one (set of) variable(s) to be renamed with `to'") else if (`tot'==0) display "{text:No variable(s) found to rename with} {result:`to'}" else { if (~`prefix') rename `found' `to' else renpfix `found' `to' } end