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
covs() not allowed in rdrobstDear statlists, I have a very brief question, but I cannot wrap my head around why this doesn't wor…
Vectorized divisionHi All, I have the following dataset. test2=sums_of_squares_weight/total_passenger_perday_adjusted …
Treatment , Post Treat in case of heterogeneous treatment timingHello all, Would like to create an event study but I'm trying to make sure I'm creating treatment, …
Difference in Difference estimation on carbon emissions in STATA 17.Dear STATA community, I have some questions regarding my analysis for my DID estimation. I am looki…
distcomp now on SSCThe command distcomp (distribution comparison) is now available on SSC, thanks to Kit Baum. It's lik…
Subscribe to:
Post Comments (Atom)
0 Response to Loop renaming from labels
Post a Comment