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
Data Setting: dropping empty variables in a quickly wayGood morning to everyone, i was wondering if there is a command that tells Stata to drop variables i…
Plotting dependent variable mean besides coefficients using esttabI am using the user-written esttab command from SSC to generate table output. I am trying to plot a …
DID with fixed effects – problem with noestimcheck?Dear Statalisters, I am estimating a difference-in-difference with fixed effects. I use the nostimc…
Stata Probit Model Interaction Term InterpretationHello everyone, for my thesis i am currently investigating the effects of solid waste (msw_reg) on …
Marginal effect with empty resultsHello, for model Code: (OLS model)X= Shock_dummy_variable + Firm Fixed effect + year Fixed effe…
Subscribe to:
Post Comments (Atom)
0 Response to Changing Type of Local Variables
Post a Comment