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: RE: skip functions containing missing variables?


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: skip functions containing missing variables?
Date   Tue, 16 Nov 2010 12:11:12 +0000

We need care over terminology here. A missing variable in your sense is perhaps better described as a variable that is not present in the dataset. 

It is easy for a reader to confuse that situation with a variable that is present but contains missing values. 

-capture- is probably what you need. 

Nick 
[email protected] 

Michael Costello

I have about 25 databases with similar (but not exactly the same)
variable lists.  I want to "clean" them up by adjusting labels,
formats, etc.  Is there a way to have stata simply skip an absent
variable so taht I can run the same .do file on every database?  For
example:

one.dta varlist: gender age date grade speed
two.dta varlist: gender date grade speed

Since age is missing from the second database if I run a script saying
"label variable age "How old is the student?" " stata would stop
running because of an error.  Or, if I tried to change the order of
the (present) variables, it would have an error when it came to the
missing age variable.

So is there a way I can avoid this error?  Is there some prefix that
says: Do only when variables are present?


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