Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Create cumulative sum by two different catagories


From   "mai mai" <[email protected]>
To   [email protected]
Subject   st: Create cumulative sum by two different catagories
Date   Thu, 7 Dec 2006 16:37:19 -0500

Hi,
I'd appreciate some help please.
I am trying to get a cumulative sum of AAR below by sector group and
diff group. So need to create four variables: the first (CAAR_1)
containing the cumulative sum by dif if the firms were in sector 1,
the second (CAAR_2) contains the cumulative sum by dif if the firms
were in sector 2, and so on: I need it to do something like this:

dif   sector    AAR       CAAR_1   CAAR_2 ....CAAR_4
1         1        2.2         2.2            .
1         1        2.2         2.2            .
1         2        3.2         .              3.2
1         2        3.2         .              3.2
1         2        3.2         .              3.2
1         3        1.0         .               .
1         3        1.0         .               .
2         1        6.6         8.8            .
2         1        6.6         8.8            .
2         2        3.0         .               5.2
2         2        6.6         .               5.2
2         2        6.6         .               5.2
2         3        6.6         .                .
2         3        6.6         .                .
3         1        1.4        10.2            .
3         1        1.4        10.2            .
3         2        1.1        .                 6.3
3         2        1.1        .                 6.3
3         2        1.1        .                 6.3
3         3        1.4        .                   .
3         3        1.4        .                   .


I cannot do by line because because the groups vary in number of
sub_occupants. I need to do it by group, can you help me?

Many thanks in advance!
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index