Panel Partial accumulation for each unit

For questions and discussion related to reading in and working with data.
vtsa
Posts: 19
Joined: Thu Oct 10, 2013 7:25 am

Panel Partial accumulation for each unit

Unread post by vtsa »

Dear Tom,
I couldn't compute the partial sums of series for each unit in the panel data set. When I run the accumulate instruction, the prog accumulates partial sums for the entire series but not for each cross-section unit. How can I fix it. Please help! Pleae find the prog attached. I will appreciate your responce.
PNARDL.rpf
(1007 Bytes) Downloaded 559 times
Attachments
Data.xlsx
(41.71 KiB) Downloaded 518 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Panel Partial accumulation for each unit

Unread post by TomDoan »

This will do the same thing as ACCUMULATE within each panel individual.

Code: Select all

dec real total
set ly_p 1//1992:1 6//2023:1 = total=%if(%indiv(t)<>%indiv(t-1),0.0,total),$
     %if(%valid(dly_p),total=total+dly_p,%na)
vtsa
Posts: 19
Joined: Thu Oct 10, 2013 7:25 am

Re: Panel Partial accumulation for each unit

Unread post by vtsa »

Thank You very much! :D
Post Reply