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
Loop a time-series regression to predict out-of-sample valuesHello there, I am quite new to Stata and after desperately searching for a solution in this forum I …
Panel data and autocorrelationDo panel data need autocorrelation? …
Loop a regression to predict out-of-sample valuesHello there, I am quite new to Stata and after desperately searching for a solution in this forum I …
assessment of similarity of baseline covariates after performing propensity score analysisDear I am Hatem Ali. I have 2 groups of patients, one received basiliximab induction therapy and the…
How spatial panel data models deal with endogeneity problem?Hi everyone, I am looking for your suggestion about how to deal with endogeneity bias which comes f…
Subscribe to:
Post Comments (Atom)
0 Response to Changing Type of Local Variables
Post a Comment