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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Selecting variables based on variable labels


From   daniel klein <klein.daniel.81@googlemail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Selecting variables based on variable labels
Date   Sat, 8 Sep 2012 10:42:50 +0200

Mitch,

picking on what you have, -lookfor- returns the variables it finds in
r(varlist). If you are able to find the variables you want (and given
Stata release 12) this should be something like

lookfor "TYPE OF RESIDENCE R IS LIVING"
ren (`r(varlist)')(foo#) ,addnum

However, given that you want to -reshape-, you are probably better of
with Austin's code.

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