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
flag certain observationDear reader, I would like to flag a certain observation if it is the 24th observation starting at th…
Interpretation of K-fold cross-validation's resultsDear all, Hope you all are doing well. I have graphical results of K-fold cross-validation checks …
Problem with negative values in log-transformationNegative values are deleted in log-transforming. How can negative values be log-transformed without …
Extracting coefficient from matrix after bayes commandCan anyone please suggest how I can extract the coefficient of my explanatory variable after using t…
How to write shorterHi reader, I would like to know how I could make these formulas a bit shorter, hope you can help. …
Subscribe to:
Post Comments (Atom)
0 Response to Loop renaming from labels
Post a Comment