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   Jean-Benoit Hardouin <jean-benoit.hardouin@orscentre.org>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: New command in SSC: -checkfor2-
Date   Mon, 19 Sep 2005 21:02:52 +0200

adiallo5@worldbank.org a écrit :

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.

OK, that's right (I have considered only one (other) aim which interests me : the possibility to obtain a list of the variables with a little amount of missing values)


I will consider the use of return, but why a table?

If you have full of variables, your outputs are difficult to read: a table allows obtaining a synthetic result !
Best,
Jean-Benoit


I'll contact you privately to further discuss about these topics.
Best regards.
Amadou.



Jean-Benoit Hardouin <jean-benoit.hardouin@ors To: statalist@hsphsun2.harvard.edu 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 : jean-benoit.hardouin@orscentre.org
*********************************************



adiallo5@worldbank.org 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"



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






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