Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Need clarification regarding egen total option


From   Michael Stewart <[email protected]>
To   [email protected]
Subject   st: Need clarification regarding egen total option
Date   Wed, 13 Feb 2013 16:49:56 -0500

HI ,
I am trying to find the behavious of the egen totalfunction

Lets see the following three commands

.1) bysort fam:egen total1=total( age )              ==> this cmd sums
the age across observations  per family

2). bysort fam:egen total2=total( age>=18 )      ==> this cmd COUNTS
the number of nonmissing values for age per family if > 18

3). bysort fam:egen total3=total( age) if age >=18   ==> this cmd
again sums the age across observations  per family if >18

why does the total option sums the ages when the option is total( age
)  where as gives the number of observations if total( age>=18 )
option is present

-- 
Thank you ,
Yours Sincerely,
Mike.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index