Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Adding variables containing empty values


From   Ziad El-Khatib <Ziad.El-Khatib@ki.se>
To   statalist@hsphsun2.harvard.edu
Subject   st: Adding variables containing empty values
Date   Wed, 2 Apr 2008 01:46:01 -0700

Dear STATA lister,
Any tips how to add (summation) 3 variables when one has empty value
(example below)
I did not want to use replace var=0 if var==. because i want to know
when all the 3 variables (ndrug1,ndrug2 and ndrug3 have empty values
at the same time)


id      visitn      ndrug1      ndrug2      ndrug3      total
-----------------------------------------------------------------------------
1      2              .                2             1             3
1      4              2                .             3             5
1      8              2                3            3             8
1      12            .                 .            .              .
2      2              .                 .            2             2
2      4              1                1            .              2

etc..




Any tips?
Thank you in advance and best regards
ziad

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