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
Interactions with time in linear mixed models (repeated data)Hi all, I'm working on the impact of blood pressure variability on cognitive function over time. I …
Arellano-Bond test AR(2)Dear Statalisters, I have one doubt about the result of my Arellano-Bond test for autocorrelation i…
Problem with negative values in log-transformationNegative values are deleted in log-transforming. How can negative values be log-transformed without …
Hardware for Stata double-digit-core versionI think I will upgrade my Stata to 32-core or more. But I am wondering what hardware I have to buy.…
Cumulative sum by order and idHi all, I am working on this dataset, in which I would like to test whether the cumulative sum of t…
Subscribe to:
Post Comments (Atom)
0 Response to Running two loops
Post a Comment