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: Start/End dates to ongoing count indicators
From 
 
Jeremy Wells <[email protected]> 
To 
 
[email protected] 
Subject 
 
st: Start/End dates to ongoing count indicators 
Date 
 
Tue, 23 Apr 2013 11:04:45 -0500 
Hi all,
I have a dataset where observations are unique projects. Each project
has a start week and end week variable, as well as a classification variable,
so the data structure looks like this:
StDt			EndDt		Class
2002wk1		2002 wk3		1
2002wk4		2002wk6		1
2002wk1		2002wk5		2
2002wk4		2002wk5		2
What I would like to have is time series data with each observation a week
and variables for each class with a count of the number of ongoing projects
in each class in each week, so the data would look like this:
Week		Class1		Class2
2002 wk1		1			1
2002wk2		1			1
2002wk3		1			1
2002wk4		1			2
2002wk5		1			2
2002wk6		1			0
The first though is -tab class, gen(class)-, but that will give me a 1 for the
start week only, but I want the count to continue to the end week.
I apologize if this has been covered, but I am struggling how on to phrase/
condense the question to search. Any ideas?
Thanks,
Jeremy Wells
Ph.D. Student
LSU Dept. of Poli. Sci.
324 Stubbs Hall
Baton Rouge, LA 70803
*
*   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/