| Date: | Mon, 3 Nov 2003 09:01:41 -0800 |
| Reply-To: | Microstructure <randistan69@HOTMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Microstructure <randistan69@HOTMAIL.COM> |
| Organization: | http://groups.google.com |
| Subject: | Formula |
| Content-Type: | text/plain; charset=ISO-8859-1 |
Dear All:
My Data set is as follows:
data abc; set abc.Calculation;
input date mmddyy8. openp highp lowp closep tradeq rsturn comp;
cards;
01/01/99 1 4 1 4 5 6 AAA
01/02/99 2 3 2 4 4 4 AAA
01/03/99 4 5 2 4 5 1 AAA
.
.
02/01/99 7 3 8 3 5 1 AAA
.
.
01/01/00 6 6 2 3 9 3 AAA
.
.
01/01/01 3 3 4 6 3 9 AAA
.
.
01/01/99 1 4 1 4 5 6 BBB
01/02/99 2 3 2 4 4 4 BBB
01/03/99 4 5 2 4 5 1 BBB
.
.
02/01/99 7 3 8 3 5 1 BBB
.
.
01/01/00 6 6 2 3 9 3 BBB
.
.
01/01/01 3 3 4 6 3 9 BBB
.
;;;
data a; set calculation;
keep date openP highP lowP closep TradeQ Rsturn Comp lagclp Return;
lagclp=closep(-1);
Return=log((lagclp/closep))*100
When I ran the program, what sas did on 1 jan 99 of BBB was to take
the last closep of AAA to calculate lagclp. This is wrong. SAS needs
to restart the calculation for BBB on jan 1 99. How do i write the
code to tell sas to restart the lagging procedure for BBB and the
other companies involved in the calculation.
Thanx in Advance
|