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