Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: rename a lot of variables


From   "Guanghui Li" <[email protected]>
To   <[email protected]>
Subject   st: rename a lot of variables
Date   Thu, 4 Nov 2004 16:44:43 -0800

Dear all,
I have personnel data from 6 companies and the maximum number of employees
in those companies is 18. There are 27 variables for each employee. The data
is shaped in the wide form, therefore, I have 18*27=486 variables in total.

I would like to reshape the data to a long form. However, the way these
variables are named is hard for me to do the reshape command.
c1p1a1     c1p1a2     .....

c2p1

c3p1

c4p1e1     c4p1e2    .....

c5yp1

c05mp1

.....
The p1 in each of those variable names represent employee 1.  Sometimes p1
is at the end of the variable names, but most of the times it is in the
middle of the variable names (342 in total) . I would like to move p1 to the
end of the variable name so that I could define 1-18 to be the "j" in the
reshape command.

I have checked the commands "rename" "renvars" "renpfix" "rensfix", but none
of them seems to be able to do this in a quick and easy way. Please give me
some suggestions.

Thank you in advance.

Guanghui Li




*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index