Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: add index to the names of some variables


From   Shourun Guo <[email protected]>
To   [email protected]
Subject   Re: st: add index to the names of some variables
Date   Tue, 13 Jul 2004 15:43:49 -0400

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index