Note that -checkfor2- runs the user-written command -nmissing-
which would need to be installed separately if a user had
not previously installed that. The help file makes
a cross-reference to this program but does not spell out
that it is required.
As it happens, it is not clear why -nmissing- is used at
all, as it is only employed to pick up the number of
missings which could, and indeed should, be done much
more efficiently and directly with a -count-.
Another detail that is worthy of note is that -checkfor2-
-sort-s on each variable in turn. This is not documented,
appears unnecessary for what the program does, and is
indeed a misfeature as in general -checkfor2- will
change the sort order of your data. I think it is a
good principle that Stata commands should only change
the sort order of your data when that is a purpose
of the command and is also explicitly documented.
Nick
[email protected]
[email protected]
> Thanks to Prof. Baum, a new Stata command is available from the SSC
> archives:
>
> -checkfor2- A Stata module to check whether a variable exists
> or not in a
> dataset.
>
> Description:
>
> checkfor2 is a routine to check for existence of a list of
> variables within a
> (usually big) data set.
> checkfor2 searchs through the data whether the variable
> exists. If it does not,
> a message is issued.
> If it does, the program looks for missings structure.
> Finally, if requested, the
> program stores the
> available variables in a macro for future use. A tolerance
> level for missings
> could also be set.
> To install the package, type:
>
> .ssc install checkfor2
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/