I have an imported dataset where I need to rename all of the variables and want to use the imported label as a part of the new name of the variables. The general idea of what I want to do is the following:
foreach var of varlist _all {
local varlabel : variable label `var'
local strN = "str" + `varlabel'
rename `var' `strN', if...
However, 'varlabel' is a number for each variable and so does not concactenate as it is an integer. To my knowledge Tostring would not work in this situation, and if it does I have been unable to figure out how. Any help on how to change the type of a local variable would be much appreciated. I've been scouring the internet for the past couple of hours to no success.
Related Posts with Changing Type of Local Variables
how to combine the tuples and parallelIn order to speed up the calculating, how to combine the use of command parallel and command tuples?…
The simplest way to output 2sls to wordDear all, Here I want to give a simpler way to output 2sls results to word. Code: sysuse auto,cle…
Foreach regression by group, Outreg2 error 'Invalid syntax'Hello all, I'm working on country wise regressions and using different codes on forum ran the follo…
Basic question on setting up survival dataHi all, I am trying to set up survival data for a cohort of breast cancer patients, following them …
Creating episodes within hospital dataHi, I have a long hospital dataset that I need to link to another long dataset to combine informatio…
Subscribe to:
Post Comments (Atom)
0 Response to Changing Type of Local Variables
Post a Comment