There are two problems here. You need a single loop and the syntax for incrementing the local macro is quite wrong.
The syntax
`i+1'
is not equivalent to the value of the local macro i plus 1.
Try it:
. local i = 42
. di "`i+1'"
42
What's happening is that Stata ignores the +1 within the macro reference as trailing garbage, but it does show what's in the macro i: it can make sense of that reference. The rule applying here is that the + could not be part of a legal macro name.
You could do this to take the local macro, add 1, and show the result:
. di "`=`i'+1'"
43
See the help for macro.
As William Lisowski points out, rename will do the renaming for you any way without an explicit loop.
But how would you loop if you did not know that, or if you were using a version of Stata that did support loops but not the extra rename facilities introduced in Stata 12? Here's one way:
local i = 1950
foreach x of varlist C-BQ {
rename `x' _`i'
local ++i
}
Another way to do it before Stata 12 would be to use renvars from the Stata Journal
renvars C-BQ \ _1950-_2016
renvars requires Stata 8 up. Naturally, underneath the surface it is executing a loop over your old variables and your new variable names.