Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65565

Time-series Cumulative statistics

$
0
0
Hi, all:

The working time-series dataset looks like as below:

Code:
Year   Place
2001     A
2001     A
2002     A
2003     A
2004     B
2005     B
2001     C
2003     C
2004     C
I want to generate a cumulative summary statistics to describe the number of observation by the Place and Year (i.e., any observations of same Place and Year beforehand should be counted)

Code:
Year   Place  Summary
2001     A             2
2002     A             3
2003     A             4
2004     B             1
2005     B             2
2001     C             1
2003     C             2
2004     C             3
So, for example, the first role of above table indicates there is 2 observations for Place A at 2001; the second role indicates that there is 3 observations for Place A before 2002 (2002 included).

I tried several ways to take advantage of _n and _N, but I can't get it works. I think the very point is the data have some duplicates (e.g., more than one observation for one year), the normal usage of _N won't distinguish those duplicates and make the results confusion. Anyone can help to think of a way to deal with this situation? Thank you in advance!

chuan

Viewing all articles
Browse latest Browse all 65565

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>