Example 51.6 Retrieving Stock Time Series by PERMNO
This example shows how to retrieve the MPRC, MASK, and MBID time series by using PERMNO key access in the STK database. For
brevity, the WHERE= option in the DATA step selects a range of MCALDT for 25 observations.
title 'Retrieve IBM Monthly PRC, ASK, and BID by PERMNO Access';
libname _all_ clear;
libname crsp sasexccm
"\\tappan\crsp1\data201008_little\MIZ201006\"
setid=20
permno=12490
itemlist="MPRC;MASK;MBID";
data mstkts_all( where=( mcaldt >= '30jun2008'd) ) ;
set crsp.mstk_ts;
run;
proc contents data=mstkts_all;
run;
proc print data=mstkts_all;
run;
Output 51.6.1: IBM’s Monthly PRC, ASK, and BID by PERMNO
The CONTENTS Procedure
WORK.MSTKTS_ALL |
25 |
DATA |
5 |
V9 |
0 |
03/02/2015 16:30:37 |
40 |
03/02/2015 16:30:37 |
0 |
|
NO |
|
NO |
|
|
WINDOWS_32 |
|
wlatin1 Western (Windows) |
|
65536 |
1 |
1 |
1632 |
25 |
0 |
YES |
C:\Users\saskff\AppData\Local\Temp\SAS Temporary Files\_TD7388_D79286_\mstkts_all.sas7bdat |
9.0401M3 |
W32_7PRO |
KYPERMNO |
Num |
8 |
6. |
6. |
PERMNO |
MASK |
Num |
8 |
12.5 |
12.5 |
Ask |
MBID |
Num |
8 |
12.5 |
12.5 |
Bid |
MCALDT |
Num |
8 |
YYMMDDN8. |
YYMMDD8. |
Caldt |
MPRC |
Num |
8 |
12.5 |
12.5 |
Prc |
12490 |
20080630 |
118.53000 |
118.63000 |
118.28000 |
12490 |
20080731 |
127.98000 |
127.93000 |
127.99000 |
12490 |
20080829 |
121.73000 |
121.77000 |
121.74000 |
12490 |
20080930 |
116.96000 |
116.19000 |
116.09000 |
12490 |
20081031 |
92.97000 |
93.54000 |
92.92000 |
12490 |
20081128 |
81.60000 |
81.72000 |
81.60000 |
12490 |
20081231 |
84.16000 |
84.22000 |
84.09000 |
12490 |
20090130 |
91.65000 |
91.73000 |
91.71000 |
12490 |
20090227 |
92.03000 |
92.18000 |
92.16000 |
12490 |
20090331 |
96.89000 |
97.10000 |
97.10000 |
12490 |
20090430 |
103.21000 |
103.39000 |
103.31000 |
12490 |
20090529 |
106.28000 |
106.38000 |
106.40000 |
12490 |
20090630 |
104.42000 |
104.38000 |
104.34000 |
12490 |
20090731 |
117.93000 |
118.01000 |
117.93000 |
12490 |
20090831 |
118.05000 |
118.06000 |
118.04000 |
12490 |
20090930 |
119.61000 |
119.56000 |
119.56000 |
12490 |
20091030 |
120.61000 |
120.63000 |
120.62000 |
12490 |
20091130 |
126.35000 |
126.43000 |
126.42000 |
12490 |
20091231 |
130.89999 |
130.89000 |
130.84000 |
12490 |
20100129 |
122.39000 |
122.32000 |
122.30000 |
12490 |
20100226 |
127.16000 |
127.22000 |
127.21000 |
12490 |
20100331 |
128.25000 |
128.30000 |
128.25999 |
12490 |
20100430 |
129.00000 |
128.89000 |
128.86000 |
12490 |
20100528 |
125.26000 |
125.17000 |
125.08000 |
12490 |
20100630 |
123.48000 |
123.41000 |
123.38000 |