Dear all,
I have been trying to add different suffixes (numbers) to a set of variables named v1, v2, v3... but my code seems not working. The suffixes come from the variable id. Namely, I want to rename my variables as follows:
v1 ==> d_1101506022
v2 ==> d_1101506032
v3 ==> d_1101506073
.
.
.
My code is as follows:
foreach x in v* {
local var = id
local suffix = `var'[`_n']
rename `x' d_`suffix'
}
Will you please tell me what I am doing wrong? Thank you
Array
Related Posts with add different suffixes to 1500+ variable names using foreach
Query on ordering coefficients from multiple models when using coefplotHi All We need help with using the coefplot command. Briefly, we have run a series logistic regress…
How do I find out which excel file was imported into STATA (origin of data?)Hey all, Months ago, I imported an excel file into stata for analysis. However, I would like to do…
Reminder: UK Stata Conference submission deadline 26 MayUK Stata Conference, 7-8 September 2023: reminder I'm bumping the thread at https://www.statalist.o…
Stata Command: including interaction terms of the endogenous variable in 2SLS using xtivregHi, I am wondering if anyone had any experience in including an interaction term in 2SLS using xtiv…
number increased or decreased?Dear All, I found this question here (in Chinese). The variable x denotes the product. Code: * Exam…
Subscribe to:
Post Comments (Atom)
0 Response to add different suffixes to 1500+ variable names using foreach
Post a Comment