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
0 Response to Running two loops
Post a Comment