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: Confirm existence of a variable(s) with wildcards in the variable name


From   Will Probert <[email protected]>
To   [email protected]
Subject   st: Confirm existence of a variable(s) with wildcards in the variable name
Date   Wed, 2 Feb 2011 12:12:53 +1000

Hi,
I'm trying to unabbreviate a variable list that contains a wildcard
and then keep those variables, if the variable(s) exist.  From my
understanding, the 'if' option in STATA's 'keep' and 'drop' commands
only act on observations, not on variables.

I'm trying code, unsuccessfully, along the lines of...

capture confirm unab new: varia*
if(_rc==0){
     unab new: varia*
     local newlist `new'
}
keep `newlist'

Any help would be much appreciated.
Regards,
Will Probert

Research Assistant
Institute for Social Science Research
The University of Queensland

*
*   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