Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Fabian Müller <Fabian-Max@gmx.net> |
To | statalist@hsphsun2.harvard.edu |
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/