Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

RE: st: label wide format variables with same label for different years


From   <[email protected]>
To   <[email protected]>
Subject   RE: st: label wide format variables with same label for different years
Date   Tue, 18 Jun 2013 12:47:40 +0100

Thank you! For some reasons I do not want to bother you with, I need
this data to be in wide format.

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: 18 June 2013 11:58
To: [email protected]
Subject: Re: st: label wide format variables with same label for
different years

This seems most unlikely to be a good idea, as many variables in graphs
and tables would now be labelled identically despite different meanings.
The more general problem is that this data structure (I won't sign up to
the word "format" here) is poor for the majority of panel or
longitudinal problems. A -reshape- is strongly advisable.

I am reluctant to hand you a loaded gun, but what you want is

foreach v of var income_* {
      label var `v' "income"
}

Nick
[email protected]


On 18 June 2013 11:52,  <[email protected]> wrote:
> Dear Statalisters,
>
> My data is in wide format and I would like to give the same label to
several variables in different years.
>
> Example:
>
> income_2013       income_2012
> 10                             8
>
> I want to label both income_2013 and income_2012 as "income". Since I 
> have many years, I am looking for a way of doing this with one command

> line instead of
>
> label variable income_2013 "income"
> label variable income_2012 "income"
>
> I intuitively tried
>
> label variable income_* "income" but this does not work, and I could
not find an answer online.
>
> Thank you for your help with this!
> Isa
>
> Please access the attached hyperlink for an important electronic 
> communications disclaimer: http://lse.ac.uk/emailDisclaimer
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

Please access the attached hyperlink for an important electronic communications disclaimer: http://lse.ac.uk/emailDisclaimer

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index