Statalist


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

st: Unbalanced panel, count number of incidents


From   "Andrew Stocking" <astocking@earth.care2.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Unbalanced panel, count number of incidents
Date   Sun, 22 Jul 2007 03:35:34 -0400

Hello.  I have an unbalanced panel of subjects who have been contacted very
irregularly over the past 5 years. Total contacts range from 40-250 during
the 5 year period depending on the person.  I'd like to create two
variables: one that counts the total number of contacts in the last 30 or 60
days and a second that sums the number of positive responses over the same
30 or 60 days.  For each contact there could be anywhere from 0-15 contacts
in the last 30 days.  

My data looks like:
ID	Date	Response	Var1	Var2
1	37200		1	1	1
1	37210		0	2	1
1	37215		1	3	2
1	37229		1	4	3
1	37231		0	4	2
2	37201		0	1	0
.....

I can't make egen count() work for me (or really anything else).  

Thanks in advance,
Andy


-----------------------------------
Andrew Stocking
University of Maryland
Ag and Resource Economics

astocking@arec.umd.edu
-----------------------------------



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