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 differents values of a variable
From
"Pablo.CARVALLO" <[email protected]>
To
[email protected]
Subject
st: count differents values of a variable
Date
Wed, 13 Jul 2011 14:42:27 -0400
Dear List,
I have the following dataset:
quarter country var1
1996q2 arg D
1996q3 arg D
1996q4 arg D
1997q1 arg A
1997q2 arg A
1997q3 arg A
1997q4 arg A
1998q1 arg D
1998q2 arg A
2002q4 arg A
2003q1 arg D
2003q2 arg D
2003q3 arg D
2003q4 arg D
2004q1 arg A
2004q2 arg D
I need a new variable to know when a new value of var1 starts and how
many quarters this value repeats.
For example, there are 3 "D" from 1996q2-1996q4, so that newvar=3.