Hey,
I have the following problem. Let's suppose I have this data set
country A B C
Germany 5 6 7
New Zealand 4 5 3
England 3 4 2
And I want to rename A into Y1960, B into Y1961 and C into Y 1962
I was trying the following
foreach num of numlist 1960(1)1970 {
foreach var of varlist A-C {
rename `var' Y`num'
}
}
However, it does not work. It only renames A and stops then with the error "variable y1960" already defined. Does anyone has an idea?
Best,
Simeon
Related Posts with Running two loops
Independent variable becomes significant when i include its squared value in regressionHi guys, I am looking into the effect of inequality on economic growth using panel estimation. Whe…
Number of PanelsHi, I am struggling to find this answer online. Is there any benefit from adding extra panels to fi…
Panel data and within individual effectsHi everyone, I have a panel dataset where I follow individuals for 12 waves (new_waves). What I am …
Trying to use .txt without a delimiterHi, I am trying to use a file that does not have a delimiter. I do have a coding book though, so I …
Generating the average of previous observations in a panelDear forum users, I have a question that I cannot seem to figure out by myself and I can't find an …
Subscribe to:
Post Comments (Atom)
0 Response to Running two loops
Post a Comment