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

Re: st: Collapsing and renaming variables


From   David Kantor <dkantor@jhu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Collapsing and renaming variables
Date   Tue, 24 Feb 2004 16:42:08 -0500

I'm not sure what you meant by the question about -collapse-, but regarding the renaming operation, you can do this:

local torename "a b c d" // and whatever else you want to apply it to

foreach var of local torename {
ren `var' `var'_old
}

Certainly this could be made into a program if one wished to do so. (In case it is of interest, I have a program to substitute suffixes in variable names.)

-- David

At 03:58 PM 2/24/2004 -0500, Adrian wrote:

Is there a way to collapse the data and tell Stata to automatically
rename the collapsed variables?

Perhaps this is too specific and not too many people would need that...

In that case, is there a way to rename a bunch of variables at once? For
instance, to tell Stata that I want variables a, b, c, d, ... renamed
a_old, b_old, c_old, d_old, ... or something like that?

Thank you.
Adrian
David Kantor
Institute for Policy Studies
Johns Hopkins University
dkantor@jhu.edu
410-516-5404

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index