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
heterofactor and ML maximizationI am using the heterofactor command (https://www.stata-journal.com/articl...article=st0431), but it …
Failing to convert .shp and .dbf dile to .dta formatHello, I'm trying to convert a gis file to .dta format. To answer a few questions: .shp and .dbf ar…
log differenced model and GMM EstimatorHi all, I have panel data (T=30) and due to potential threat of non stationarity in my data i've tr…
chnaging values of a variableDear Listers, I am using Stata 15.1. I am working with a dataset with more than a million observati…
Populating a column with valuesI need to populate the empty columns with corresponding values within that year, it could be that I …
Subscribe to:
Post Comments (Atom)
0 Response to Renaming variables using the 'foreach' command
Post a Comment