Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Rename multiple variables


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Rename multiple variables
Date   Sat, 2 Apr 2011 18:20:30 +0100

This makes little sense to me.

Several variables must have several differemt names.

Perhaps you want to change the prefix from -v- to -year-. -renpfix-
would suffice, but -renvars- has an option for that. (-renvars- is a
user-written program from SJ; please remember to explain where such
programs you refer to come from.)

Perhaps you want to restructure the data with a -reshape-.

Nick

On Sat, Apr 2, 2011 at 1:12 PM, emanuele mazzini
<madsoenistata@gmail.com> wrote:

> I have the following problem with renaming variables: I would like to
> rename variables from v2 to v58 with only one name, which is year. I
> know that I can use the renvars command, but if I type
>
> renvars  v2-v58  \ year
>
> I get the following error message:
>
> lists of old and new varnames unequal in length
>
> which obviously refers to the fact that I did not specified a new name
> for all the variables. But the name would be the same for all of them,
> so the question is the following:
> is there a way to extend the command to all the variables I'm
> interested in, without typing year 58 times?
>

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