Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: stata question?


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: stata question?
Date   Mon, 16 Feb 2009 12:25:59 -0000

<>

No. One method using -renvars- is explained in the FAQ already referred
to you by Martin Weiss in this thread. Another method is to use an
explicit loop. 

foreach v of var Afghanistan-Zimbabwe { 
	rename `v' country`v' 
}

subject to variables being in the order specified and not violating the
length limits on variable names. 

Nick 
[email protected] 

Arina Viseth

Thank you all very much for your answers. I understand that in order to
use reshape, I would need to have the names in each group to all begin
with the same stubname. However, my countries' names are all different:
they go alphabetically from afghanistan, albania, algeria...etc to
zimbabwe. I could change the name of each country and enter country1 for
afghanistan country2 for albania..etc, but instead of doing it manually
for 210 countries, is there another way to reshape my data the way
mentioned below?


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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