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: summarize by different levels/groups with -egen- ?


From   Patricia Biedermann <[email protected]>
To   [email protected]
Subject   st: summarize by different levels/groups with -egen- ?
Date   Fri, 11 Jan 2013 12:11:27 +0100

Dear STATA users,

I want to summarize following:

School		Class		Pathogen		
A			A1			H
A			A1			T
A			A1			H
A			A2			S
A			A2			H
A			A3			K
A			A3			I
B			B1			S
B			B1			T
B			B2			H
	
I’ve visited different classes in different schools. In each class I
checked if the children were infected with some kind of pathogen.
-	I found e.g that in class A1 two children were infected with pathogen H.
-	Now, I want to summarize that I just found pathogen H in class A1
WITHOUT the actual amount of pathogen itself (2 times in this case);
Basically “Was pathogen H found in class A1” = yes or no; Finally, the
information should be presented at school level. ("How many classes in
school A pathogen H was found?)

So far I tried egen, bysort / =_n==N and commands. I also created
dummy variables for each pathogen.  It never worked out the right way.
Maybe it’s just an error in reasoning.

THANKS A LOT in advance.

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