Hello, I am sure there is a simple way to do the following but I haven't
been able to find it searching through the help files or the listserv
archive:
I have three variables - school (grouping variable), gender (binary), and
grad (binary). What I want to calculate is for each school, how many males
graduated?
I have done the following:
sort sch gender grad
by sch: egen mg = count(lastsch) if gender==1 & grad==1
by sch: egen malegrads = max(mg)
drop mg
However, this only works if there are one or more male grads in the school.
I can't figure out how to get zero values to populate in schools where the
if condition is not satisfied.
Thanks for your help!
Julie
Julie K. Rajaratnam
Ph.D. Candidate
Department of Population and Family Health Sciences
Johns Hopkins Bloomberg School of Public Health
[email protected]
*
* 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/