Hi everybody,
I'm trying to replace an existing variable label with a subtract of the existing varlabel (first nine characters) within a Stata loop:
my code looks like this:
foreach var of varlist _all {
local varlabel: var label `var'
local newname: substr(`varlabel',1,9)
label `var' `newname'
}
Then I receive the following error:
substr not allowed ??
Hope you can help
Kind regards Frank
Related Posts with substr existing variable label and replace existing varlabel?
Preliminary analysesHi all, quite a general question again. Which are the best tools in STATA to provide preliminary ana…
Shaded graphDear all, I was wondering if anyone could point me in the right direction on how to produce a shade…
Sort out the observations from a large sampleHello everyone. I am a new user of Stata and new member of this forum. May I ask you a question. I a…
Foreach and forevalues loopHi, I have a list of variables that look as follows: max_1 max_2 max_3. All the numbers in the vari…
Number of participants after Cox regression with listwise deletion of missing data.Dear Statalist, I am using multivariable Cox regression. My main exposure (TS_WHO_gold) is a catego…
Subscribe to:
Post Comments (Atom)
0 Response to substr existing variable label and replace existing varlabel?
Post a Comment