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

Re: st: Two digit prefix to variables


From   [email protected]
To   [email protected]
Subject   Re: st: Two digit prefix to variables
Date   Thu, 01 Jul 2004 14:09:06 -0500

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/



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