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: Count observations previous to date


From   Fabian Müller <[email protected]>
To   [email protected]
Subject   st: Count observations previous to date
Date   Thu, 31 May 2012 23:53:06 +0200

Hey Guys,

i got the following problem:

I have a dataset with several countries (ccode) over time (year). Each Observation got a binary variable(ongo) showing if there was a war or not.
Now i need to create a variable for each observation counting the number of wars the particular country was involved until (and inclusive) to this date.

For example:

ccode	year	ongo	count
200		2000	0		0
200		2001	1		1
200		2002	0		1
200		2003	0		1
200		2004	1		2
200		2004	1		3

Can't figure out a way to do this.

Tanks for Help

Fabian 



*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index