Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: loop to rename vars


From   "Friedrich Huebler" <fhuebler@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: loop to rename vars
Date   Thu, 9 Oct 2008 23:45:05 -0400

mai7777,

ds
local i = 1
foreach var of varlist `r(varlist)' {
  ren `var' var`i'
  local ++i
}

Friedrich

On Thu, Oct 9, 2008 at 11:31 PM, mai7777 <mai7777@gmail.com> wrote:
> How can I loop over vars to rename them by their order number.
> so they become var1, var2, var3...?
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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