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
Unbalanced Panel data xtlogit Hi all, I have unbalanced panel data from 2010-2017 of people who participated in a screening prog…
Generalized Difference-in-differences with two-way fixed effect modelDear researchers, I have used the following model: Code: xtreg GG i.Event##(c.centered_Age c.cente…
String variablesHi STATALIST, I have a string variable and detected ga68 out of it by: Code: gen ga68 = (strpos(…
How to use explicit coding for multiple dummies in regression (no factor notation)Hi. I would like to run a fixed effects regression containing a continuous-categorical interaction w…
Proportion confidence interval with 95% CIHow I can make a two way plot with CI. Like this graph …
Subscribe to:
Post Comments (Atom)
0 Response to Running two loops
Post a Comment