Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: New command in SSC: -checkfor2-


From   adiallo5@worldbank.org
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: New command in SSC: -checkfor2-
Date   Mon, 19 Sep 2005 13:40:44 -0400

A long way to go before becoming a good stata programmer.
                                                                                 
 Thanks to Nick.                                                                 
 I will make the necessary corrections today and resubmit.                       
 You've made two very good observations. And I really need                       
 that kind of remarks to help me improve my first steps as                       
 a real stata programmer.                                                        
 I am so used of nmissing that I guess I've used it without even                 
 noticing it.                                                                    
 In the same token, working with DHS data usually require sorting                
 data before attempting many managements.                                        
 I guess there also, my old reflexes just prompted up, without even              
 noticing.                                                                       
 Again, thanks for your good remarks. In the future, I'll be more                
 cautious to these kind of details.                                              
 Amadou.                                                                         
                                                                                 




                                                                                                                                               
                      "Nick Cox"                                                                                                               
                      <n.j.cox@durham.ac.uk>           To:       <statalist@hsphsun2.harvard.edu>                                              
                      Sent by:                         cc:                                                                                     
                      owner-statalist@hsphsun2.        Subject:  st: RE: New command in SSC: -checkfor2-                                       
                      harvard.edu                                                                                                              
                                                                                                                                               
                                                                                                                                               
                      09/19/2005 01:05 PM                                                                                                      
                      Please respond to                                                                                                        
                      statalist                                                                                                                
                                                                                                                                               
                                                                                                                                               
                                                                                                                                               




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
n.j.cox@durham.ac.uk

adiallo5@worldbank.org

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



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



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index