foreach var of varlist * {
rename `var' foo_`var'
}
Hope this helps,
Scott
----- Original Message -----
From: [email protected]
Date: Thursday, July 1, 2004 1:59 pm
Subject: Re: st: Two digit prefix to variables
> Regarding my earlier message:
>
> I wanted to add that I am not looking to type "rename var 95var"
> for every
> variable. I would like to write and use a program to effect the
> change.
> Thanks,
> Reza
>
> Quoting [email protected]:
>
> > Dear Statalisters,
> >
> > Could you please help me work out how to attach a two digit
> numerical prefix
> > to
> > all my variables? I am preparing to append surveys from
> different dates but
> > that have the same variable names, and I would like to
> distinguish between
> > them
> > by adding a two digit year prefix (e.g. hhid becomes 95hhid).
> This will be
> > done
> > before appending the datasets, so that when I do append I can
> distinguish> between the variables.
> >
> > I have not yet taken the Stata programming course (hope to
> soon), so I'm
> > unsure
> > where to start.
>
*
* 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/