I want to rename variables:
rename f120_0_s1 f120_s1_0_
rename f120_1_s1 f120_s1_1_
rename f120_2_s1 f120_s1_2_
rename f120_3_s1 f120_s1_3_
rename f120_4_s1 f120_s1_4_
rename f120_5_s1 f120_s1_5_
rename f120_6_s1 f120_s1_6_
rename f120_7_s1 f120_s1_7_
rename f120_8_s1 f120_s1_8_
rename f120_9_s1 f120_s1_9_
rename f120_10_s1 f120_s1_10_
rename f120_11_s1 f120_s1_11_
rename f120_12_s1 f120_s1_12_
rename f120_13_s1 f120_s1_13_
rename f120_14_s1 f120_s1_14_
rename f120_15_s1 f120_s1_15_
rename f120_0_s2 f120_s2_0_
rename f120_1_s2 f120_s2_1_
rename f120_2_s2 f120_s2_2_
rename f120_3_s2 f120_s2_3_
rename f120_4_s2 f120_s2_4_
rename f120_5_s2 f120_s2_5_
rename f120_6_s2 f120_s2_6_
rename f120_7_s2 f120_s2_7_
rename f120_8_s2 f120_s2_8_
rename f120_9_s2 f120_s2_9_
rename f120_10_s2 f120_s2_10_
rename f120_11_s2 f120_s2_11_
rename f120_12_s2 f120_s2_12_
rename f120_13_s2 f120_s2_13_
rename f120_14_s2 f120_s2_14_
rename f120_15_s2 f120_s2_15_
…
till s17
How to write loop code for this or any other parsimonious ways? I tried the following, but obviously there is something wrong:
forvalues i = 0/15 j = 1/17 {
rename f120_`i’_s`j’ f120_s`j’_`i’_
}
Many thanks!
Related Posts with How to write a loop code for this following case as detailed in the post?
(Country) fixed effects for bilateral trade data in gravity modelHello everyone, I'm currently working on a Gravity Model and I'm quite confused about how to proper…
Data Set required for Economic Turmoil and ConflictHello I am looking for two dataset to create dummy variables from. 1. Regarding Economic Turmoil ex.…
New to stata need help.hi my final year project involves analyzing bicycle crashes in my state, im new to the software stat…
Merge IssueHello Everyone, Hope you are doing great. I am running my code, but right in the middle of my code …
annual cross sectional regression versus panel regressionDear all In one article I have read that they estimate "average coefficients from ten annual (2005–2…
Subscribe to:
Post Comments (Atom)
0 Response to How to write a loop code for this following case as detailed in the post?
Post a Comment