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 recode missing values within a range in StataI asked a similar question earlier. I'm attempting to fill in missing values such that observations …
Blinder–Oaxaca decompositionI'm planning for Blinder–Oaxaca decomposition for a study. In the standard B-O decomposition there a…
How to do Reality check and SPA test by Stata?Dear Statalist, I want to know whether there are any user written commands by stata for performing R…
How to create interaction variable in stataI have 2 independent variables and i need to create an interaction from both variable. The first var…
No constant in fixed-effect regressionDear all: Hope you are doing well and healthy. I am writing to ask a quick question about the fixed…
Subscribe to:
Post Comments (Atom)
0 Response to Changing Type of Local Variables
Post a Comment