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

Re: st: Add


From   Dan Blanchette <[email protected]>
To   [email protected]
Subject   Re: st: Add
Date   Fri, 20 Feb 2004 14:22:47 -0500 (EST)

One combination not cosidered in your example data is
    A     B
    0     0

which means your final data should look like this:
    A     B    C
    0     0    0

and not like this:
    A     B    C
    0     0    .


So it seems to me you have to consider missing:

egen C=rsum(A B)
replace C=. if A==. & B==.


dan



So any code that

>>> [email protected] 02/20/04 02:49pm >>>
How I can add two variables without consider missing-values?

For example i have two variables A anb B:

    A     B
    7     .
    1     3
    3     .
    .     .
    1     4
    .     5


I would like plus A + B = C


    A     B      C
    7     .      7
    1     3      4
    3     .      3
    .     .      .
    1     4      5
    .     5      5


Thank`s in advance!

Jorge Tuesta
MTPE


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