Date: Thu, 16 Apr 1998 23:00:35 -0500
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Robin Chou <robin-chou@UIOWA.EDU>
Organization: Department of Finance, The University of Iowa
Subject: Help: How to compare observations?
Content-Type: text/plain; charset=us-ascii
I have been working on this problem for some time but can't figure out
how to program it in SAS. I would be grateful if you can help me out.
I have a data set of stock prices which looks like:
Name Price Time
IBM 13.0 34200
IBM 13.2 34300
IBM 13.4 34550
IBM 12.9 34650
IBM 12.5 34800
IBM 12.8 34860
IBM 13.0 34960
IBM 13.2 35350
IBM 13.5 35400
. . .
. . .
. . .
Where the time is cumulative seconds from midnight.
Now, I need to calculate the price difference between a observation and
the first following observation that is at least 300 seconds after it.
For example, I want to calculate the price difference between the first
observation and the fourth observation because the fourth observation is
the first following observation that is at least 300 seconds after the
first one. Similarly, the second observation is also compared to the
fourth observation and the price difference between them is calculated,
because the fourth observation is also the first one that is at least
300 seconds away from the second one. Same comparison and calculation
are done for every observation in the data set.
Any suggestions will be greatly appreciated. Thank you for your