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   [email protected]
To   [email protected]
Subject   Re: st: RE: New command in SSC: -checkfor2-
Date   Mon, 19 Sep 2005 14:48:43 -0400

Jean,
I will try to improve my code based on your remarks.
Essentially, I used anything in place of varlist because with the latter
the program aborts when a variable specified does not
exist. But this is the core of the program: check whether
the variable exists or not.
I will consider the use of return, but why a table?
I'll contact you privately to further discuss about these topics.
Best regards.
Amadou.



                                                                                                                                               
                      Jean-Benoit Hardouin                                                                                                     
                      <jean-benoit.hardouin@ors        To:       [email protected]                                                
                      centre.org>                      cc:                                                                                     
                      Sent by:                         Subject:  Re: st: RE: New command in SSC: -checkfor2-                                   
                      owner-statalist@hsphsun2.                                                                                                
                      harvard.edu                                                                                                              
                                                                                                                                               
                                                                                                                                               
                      09/19/2005 02:28 PM                                                                                                      
                      Please respond to                                                                                                        
                      statalist                                                                                                                
                                                                                                                                               
                                                                                                                                               
                                                                                                                                               




Dear Amadou,
I find several drawbacks in the programing of -checkfor2- :
      - the use of "anything" instead of "varlist" in the syntax command
avoids to use list of variables as var1-var10 or var*
      - the idea to use a global macro variable is, from my mind, a bad
idea (I prefer a "return" command)
      - the "red" characters concerns by convention the error messages
and are not adapted to an output
      - the "outputs" as string are not very easy to read when we have
full of variables (why not a table)
      - the smcl syntax in the hlp file is uncorrect to format the
paragraphs: the result is not very nice
      - the classical way to present the hlp file is to separate the
description of the options and the syntax (in 2 parts)
I hope this help !
The idea of your command is good, but your command is not very easy to
use !

/*Amadou, pas de probl�me si tu as besoin d'aide en fran�ais pour
am�liorer ta commande !*/

Jean-Benoit Hardouin


*******************************************
Jean-Benoit Hardouin
Regional Health Observatory - Orl�ans - France

Biostatisticien
Observatoire R�gional de la Sant� du Centre
BP 2439
1, rue Porte Madeleine
45032 Orl�ans Cedex 1
t�l : 02 38 74 48 80
fax : 02 38 74 48 81
Email : [email protected]
*********************************************



[email protected] a �crit :

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

>                      <[email protected]>           To:
<[email protected]>
>                      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
>[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/
>
>
>
>*
>*   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/




*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index