my variables are named B, C, D, E,... EY (because i imported from excel), and they have labels such as 512BXIPI_BP6_USD.Q, 513BXIPI_BP6_USD.Q.....

I want to create a loop to convert the variable names to be y512, y513.. i wrote the following but it returns.."512BXIPI_BP6_USD: operator invalid"... help will be appreciated..

keep year B-EY
foreach v of varlist B-EY {
local x: variable label `v'
local nz = substr(`x', 1,3)
rename `v' y`nz'
}