Statalist


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

st: Expanding observations and duplicating some values


From   Hannah Goble <[email protected]>
To   [email protected]
Subject   st: Expanding observations and duplicating some values
Date   Wed, 25 Mar 2009 08:16:54 -0500

Everyone,

I have a relatively large data set of multiple units observed over a length of days. On each day, an event may occur or not; an event may occur more than once per day. Currently, on days in which no events occur in a unit, there is no observation for that unit on that day, but I'd like to have an observation for each unit on each day of the observation period. In other words, the data currently look something like this,


Unit		Day		Number of Events	Cumulative Events
1		3			4					4
1		5			1					5
2		1			1					1
3		3			2					2
3		4			1					3


and I'd like them to look like this,


Unit 	Day		Number of Events	Cumulative Events
1		1			0					0
1		2			0					0
1		3			4					4
1		4			0					4
1		5			1					5
2		1			1					1


Each unit is missing a different number of observations, and, although some of variables for the observations to be added will be zero, the cumulative count variables need to take their values from the most recent day on which an event occurred. Does anyone have advice on expanding these observations and getting Stata to pull some values from existing observations?

Thank you for your time,
Hannah


Hannah Goble
Ph.D. Candidate
Department of Political Science
University of Wisconsin - Madison
110 North Hall
1050 Bascom Mall
Madison, WI 53706
[email protected]



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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