my variables are named B, C, D, E,... EY (because i imported from excel), and they have labels such as 512BXIPI_BP6_USD.Q, 513BXIPI_BP6_USD.Q.....
I want to create a loop to convert the variable names to be y512, y513.. i wrote the following but it returns.."512BXIPI_BP6_USD: operator invalid"... help will be appreciated..
keep year B-EY
foreach v of varlist B-EY {
local x: variable label `v'
local nz = substr(`x', 1,3)
rename `v' y`nz'
}
Related Posts with Loop renaming from labels
regress by stateHi Statalist, I have a dataset, which includes wk(weekdays), wk2(weekend), sn(state by group), reso…
"Reshaping" data to panel dataI cannot include my source data due to sensitivity, but if needed I will post a template with made u…
Update to -dstat- (and -moremata-) available from SSCAn update to the dstat package is available from SSC. dstat is a general command to estimate summary…
a command to create a new variable starting from a specific yearI have data set from two different time periods, the first periods from the year 1990 to 2019 and th…
Construct parents' education from the censusHi, I have a problem on constructing parents' education from the census data. The original variable…
Subscribe to:
Post Comments (Atom)
0 Response to Loop renaming from labels
Post a Comment