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
stata doesn't recognize missings in string variableI want to delete observations that have missing data for a particular variable but stata does not re…
Adding 'proportion' to esttab command.Dear All, I am estimating a logistic fixed effects regression to estimate the effect of a policy ch…
Update to -kmatch- available from SSCA maintenance update to kmatch is now available from SSC. Type Code: . ssc install kmatch, replace…
Update to -iscogen- available from SSCAn update to the iscogen package is now available from SSC. Type Code: . ssc install iscogen, repl…
Equivalent of 'exposure' variable for xtlogit regression for diff-in-diffDear All, I am running a logistic FE regression to estimate a the effect of a 'treatment' using a g…
Subscribe to:
Post Comments (Atom)
0 Response to Loop renaming from labels
Post a Comment