Hi

I am trying to start a loop so that I can rename my variables. I tried using the same format I used for another foreach loop that works fine, but not sure why this one gives me a syntax error on the rename.

foreach v of varlist D E F G H I J K L M N O P Q R S T U V W X Y Z AA AB AC AD AE AF AG AH { //the letters here refer to the columns of the excel I am using
local x : variable label `v' //the local macro x is storing the labels of variable v (or associated to column v)
rename `v' y`x' //the new name will be y*label*
format y`x' %td //formating to date DDmonYYYY
}

Would be really grateful for any hints to where I might be going wrong with this. Probably because I have been fussing on it for the past hour, I cannot seem to see the answer.

Thanks in advance
LP