Ben Kriechel
> I have a data set which uses different variable
> prefixes for different
> waves of the panel. So the variable name of the first wave is:
> a_varname
>
> To work with all the waves using the same commands I
> would like to
> remove the different prefixes (a_ for the first wave, b_ for the
> second and so on). To this end I used the "renpfix"
> command. However I
> could not figure out how I could replace the prefix for
> "nothing",
> i.e. I want to change
>
> a_varname ===> varname
>
> How can that be done?
Ernest Berkhout
> renpfix a_ will of course only work once, as you can't have
> multiple
> variables with the same name. You want either of the
> following two options:
>
> 1) use a loop with the help of -foreach- around the
> commands that you
> want to act on multiple variables.
> 2) use -reshape- . Read the manual for more information. Take
> advantage of the knowledge that in most cases a long data
> structure (all
> wave stacked 'on top' of each other, sharing the same
> variables) is more
> convenient than a wide datastructure (the one you have now,
> every wave
> needing its own new variables).
>
Another tool in this area is -renvars- from STB-60.
Nick
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/