Statalist


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

Re: st: loop to rename vars


From   "Friedrich Huebler" <[email protected]>
To   [email protected]
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 <[email protected]> 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index