Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: Start/End dates to ongoing count indicators

From   Jeremy Wells <>
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?


Jeremy Wells
Ph.D. Student
LSU Dept. of Poli. Sci.
324 Stubbs Hall
Baton Rouge, LA 70803

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index