Statalist The Stata Listserver


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

Re: st: PLEASE, Cumulative by group


From   "Mohamad Al-Ississ" <Mohamad_Al-Ississ@ksg07.harvard.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: PLEASE, Cumulative by group
Date   Sat, 18 Nov 2006 13:07:57 -0500

Wonderful, it worked!
Many thanks for the prompt response!

Mohamad
Hi,
I am wondering if you can help me. I am trying to get a cumulative sum
of AAR below by dif group. So I need the CAAR to do something like
this:

dif   AAR       CAAR
1     2.2         2.2
1     2.2         2.2
1     2.2         2.2
1     2.2         2.2
2     6.6         8.8
2      6.6        8.8
2      6.6        8.8
2      6.6        8.8
3      1.4        10.2
3      1.4        10.2
3      1.4        10.2

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?
Thanks,


. by diff, sort: gen CAAR = AAR if _n==1
. replace CAAR = sum(CAAR)



--
kohler@wz-berlin.de
+49 (0)30 25491-361


--
Mohamad Al-Ississ
Candidate, Masters in Public Administration
in International Development,
Kennedy School of Government
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index