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
Difference between vce(cluster) and vce(bootstrap)?I'm using a fixed effects model. When dealing with heteroscedasticity and autocorrelation, I'm not s…
Merge two datasets wih the same variable namesHi there, I have several datasets, each with the prediction error of different forecast models. I w…
Probit marginal effectsI estimated the following probit model: Code: probit enrolled i.male##c.wealth i.male##c.oppcost h…
Problem encoding dates: unordered valueHi all: I am gettings problems when I encode a date variable, to explain my problem I will use this…
New version of -ranktest- available on SSCWith thanks to Kit Baum, a new version of ranktest by Kleibergen-Schaffer-Windmeijer, version 2.0.03…
Subscribe to:
Post Comments (Atom)
0 Response to Running two loops
Post a Comment