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]

st: Selecting variables based on variable labels


From   "Mitch Downey" <[email protected]>
To   [email protected]
Subject   st: Selecting variables based on variable labels
Date   Fri, 7 Sep 2012 18:09:20 -0700 (PDT)

Hello,

I'm using the National Longitudinal Survey of Youth. There are several
series of variables where the same question was asked over multiple years.
E.g.,

R0188000  TYPE OF RESIDENCE R IS LIVING 79
R0402800  TYPE OF RESIDENCE R IS LIVING 80
R0612100  TYPE OF RESIDENCE R IS LIVING 81
R0828400  TYPE OF RESIDENCE R IS LIVING 82
R1075700  TYPE OF RESIDENCE R IS LIVING 83
R1451400  TYPE OF RESIDENCE R IS LIVING 84
R1798600  TYPE OF RESIDENCE R IS LIVING 85
R2160200  TYPE OF RESIDENCE R IS LIVING 86
R2369100  TYPE OF RESIDENCE R IS LIVING 87

where R0188000 is the variable name and TYPE OF RESIDENCE R IS LIVING 79
is the variable label. Unfortunately, the variable names are random. This
makes it impossible to select a group of variables using res* (for
instance) or res79-res87. The only way I can find this group of variables
is by typing
-- lookfor "TYPE OF RESIDENCE R IS LIVING" --

I would like to identify a list of variables using the lookfor command and
either create a list or rename them in a sequential way. Is there a way to
do this? Can you build a variable list from lookfor results? My ultimate
goal is to make the dataset long format, so if anyone has and idea to
shortcut straight to that, I'm all ears.

Thank you,
Mitch
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index