| Date: | Thu, 11 Mar 2004 11:36:33 -0800 |
| Reply-To: | sonia afroz <afroz_sonia@HOTMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | sonia afroz <afroz_sonia@HOTMAIL.COM> |
| Subject: | lag Return upto 12 time for unbalanced panel |
| Content-Type: | text/plain; format=flowed |
|---|
Hi,
I have unbalanced panel data. I have observations for several thousand firms
for 229 time periods, but not all the firms have data for all the time
periods.
Say my dataset looks like:
FirmID Time Return
A 1 1.2
A 2 1.3
A 3 2.4
A 4 1.7
B 1 4.3
B 2 4.9
B 3 4.5
B 4 4.0
I want to create new columns in my dataset where is Return(t-1) will have
one preiod lagged return and return (t-1) will have two period lagged return
and so on and so forth for 12 lags for each firm. I tthink we need to use a
loop for each firm, so that the lagged returns are for each firm.
The dataset I want will look like the following:
FirmID Time Return return(t-1) return(t-2)
A 1 1.2 . .
A 2 1.3 1.2 .
A 3 2.4 1.3 1.2
A 4 1.7 2.4 1.3
B 1 4.3 . .
B 2 4.9 4.3 .
B 3 4.5 4.9 4.3
B 4 4.0 4.5 4.9
Please let me know what sas code I should use for this
purpose.
Thanks,
Sonia Afroz
_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now!
http://clk.atdmt.com/AVE/go/onm00200415ave/direct/01/
|