Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: How to label the value 999999999999


From   "Ziad El-Khatib" <Ziad.El-Khatib@ki.se>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to label the value 999999999999
Date   Wed, 8 Oct 2008 11:50:18 +0100

Thank you Maarten, much appreciated!
ziad

On Wed, Oct 8, 2008 at 11:45 AM, Maarten buis <maartenbuis@yahoo.co.uk> wrote:
> --- Ziad El-Khatib <Ziad.El-Khatib@ki.se> wrote:
>> I have similar situation to yours (for unknown blood results) and
>> code them 999999999999.
>> I so as Sergiy suggested or add 'if var!=999999999999' (which can be
>> annoying sometimes).
>
> You can simplify that (and thus avoid typos) in a number of ways:
>
> 1) Keep the raw data asis, but create a .do-file called dataprep.do
> that will contain a set of commands like this:
>
> *----------- dataprep.do -----------------
> use rawdata.dta, clear
> recode var = . if var == 999999999999
> assert var < 999999999999 | var == .
> other manipulations of the data
> *----------- end dataprep.do ------------
>
> Notice that dataprep.do does not save the "cleaned" data. This is also
> a good place to add some checks like the -assert- command. I would also
> liberaly add comments to document what you are doing to your data and
> why. Than you write another .do file for your analysis, call it
> analysis.do, and it would read like this:
>
> *----------- analsysis.do -------------
> do dataprep.do
> sum var
> reg y x var
> some more wonderful analyses
> *------------ end analysis.do ---------
>
> 2. You can use -mark- as described in (Jann 2007):
>
> mark touse if var == 999999999999
> sum var if touse
> reg y x var if touse
>
> Hope this helps,
> Maarten
>
> Ben Jann (2007) Stata tip 44: Get a handle on your sample. The Stata
> Journal, 7(2):266--267.
> http://www.stata-journal.com/article.html?article=dm0030
>
>
> -----------------------------------------
> Maarten L. Buis
> Department of Social Research Methodology
> Vrije Universiteit Amsterdam
> Boelelaan 1081
> 1081 HV Amsterdam
> The Netherlands
>
> visiting address:
> Buitenveldertselaan 3 (Metropolitan), room N515
>
> +31 20 5986715
>
> http://home.fsw.vu.nl/m.buis/
> -----------------------------------------
>
>
>
> *
> *   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/
>
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index