I am trying to rename multiple variables corresponding to baseline characteristics, endline characteristics and endline2 characertistics into wave1 wave2 and wave3 so that I can reshape the data into a long format based on these three time periods.
I used the following codes however it does not seem to work despite multiple tries at reformatting it, STATA gives me an error message everytime:
local vars "asset_tot_value iagri_month ibusiness_month ipaidlabor_month ranimals_month ctotal_pcmonth"
foreach k of local vars {
rename `k'_bsl `k'1
rename `k'_end `k'2
rename `k'_fup `k'3
}
Is there something wrong with how I am coding this?
Related Posts with Renaming variables using the 'foreach' command
Within .ado files, is there a way to restore data but keep, until the end of program, tempvars created by the program?Dear All, I have a somewhat involved problem, but I think it boils down to this. I'm writing a progr…
Creating Two Matrices from a Data FileDear Statalisters: I have a data file in the following format: clear input str2(firmid ownerid) floa…
How to make interactive pie charts (three)?How to create a graph with interactive pie charts (three). For example, I made a graph (find below) …
Gini coefficient standard errorsDear all, Is there any Stata module available that is able to produce Gini coefficients with standa…
Expanding dataset to make it balanacedHi All, My current dataset resembles the following: Code: * Example generated by -dataex-. To ins…
Subscribe to:
Post Comments (Atom)
0 Response to Renaming variables using the 'foreach' command
Post a Comment