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 <[email protected]>
To   [email protected]
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.
David Kantor
Institute for Policy Studies
Johns Hopkins University
[email protected]

*   For searches and help try:

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