Shouldn't use the double quote.
Try
foreach var of varlist a-d {
               rename `var' `var'_i
               }
 |  On Tue, 13 Jul 2004 15:24:01 -0400
 |  "Oleksandr Shepotylo" <[email protected]> wrote:
 |  Hi ,
 |  
 |  I would like to add index i to some variable names. What is wrong with my
 |  code:
 |  
 |  variables: id a b c d
 |  
 |  foreach var of varlist a-d {
 |    rename "`var'"  "`var'""_i"
 |  }
 |  
 |  Thank you
 |  
 |  *
 |  *   For searches and help try:
 |  *   http://www.stata.com/support/faqs/res/findit.html
 |  *   http://www.stata.com/support/statalist/faq
 |  *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/