[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: PLEASE, Cumulative by group
On Saturday 18 November 2006 18:32, Mohamad Al-Ississ wrote:
> 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)
--
[email protected]
+49 (0)30 25491-361
*
* 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/