Example 39.6 Retrieving Stock Time Series by PERMNO

This example shows how to retrieve the MPRC, MASK, and MBID time series by 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 39.6.1 IBM’s Monthly PRC, ASK, and BID by PERMNO
Retrieve IBM Monthly PRC, ASK, and BID by PERMNO Access

The CONTENTS Procedure

Data Set Name WORK.MSTKTS_ALL Observations 25
Member Type DATA Variables 5
Engine V9 Indexes 0
Created Wed, Feb 16, 2011 02:14:56 PM Observation Length 40
Last Modified Wed, Feb 16, 2011 02:14:56 PM Deleted Observations 0
Protection   Compressed NO
Data Set Type   Sorted NO
Label      
Data Representation WINDOWS_32    
Encoding wlatin1 Western (Windows)    

Engine/Host Dependent Information
Data Set Page Size 4096
Number of Data Set Pages 1
First Data Page 1
Max Obs per Page 101
Obs in First Data Page 25
Number of Data Set Repairs 0
Filename C:\DOCUME~1\saskff\LOCALS~1\Temp\SAS Temporary Files\_TD236_VMW0296_\mstkts_all.sas7bdat
Release Created 9.0301B0
Host Created XP_PRO

Alphabetic List of Variables and Attributes
# Variable Type Len Format Informat Label
1 KYPERMNO Num 8 6. 6. PERMNO
4 MASK Num 8 12.5 12.5 Ask
5 MBID Num 8 12.5 12.5 Bid
2 MCALDT Num 8 YYMMDDN8. YYMMDD8. Caldt
3 MPRC Num 8 12.5 12.5 Prc

Retrieve IBM Monthly PRC, ASK, and BID by PERMNO Access

Obs KYPERMNO MCALDT MPRC MASK MBID
1 12490 20080630 118.53000 118.63000 118.28000
2 12490 20080731 127.98000 127.93000 127.99000
3 12490 20080829 121.73000 121.77000 121.74000
4 12490 20080930 116.96000 116.19000 116.09000
5 12490 20081031 92.97000 93.54000 92.92000
6 12490 20081128 81.60000 81.72000 81.60000
7 12490 20081231 84.16000 84.22000 84.09000
8 12490 20090130 91.65000 91.73000 91.71000
9 12490 20090227 92.03000 92.18000 92.16000
10 12490 20090331 96.89000 97.10000 97.10000
11 12490 20090430 103.21000 103.39000 103.31000
12 12490 20090529 106.28000 106.38000 106.40000
13 12490 20090630 104.42000 104.38000 104.34000
14 12490 20090731 117.93000 118.01000 117.93000
15 12490 20090831 118.05000 118.06000 118.04000
16 12490 20090930 119.61000 119.56000 119.56000
17 12490 20091030 120.61000 120.63000 120.62000
18 12490 20091130 126.35000 126.43000 126.42000
19 12490 20091231 130.89999 130.89000 130.84000
20 12490 20100129 122.39000 122.32000 122.30000
21 12490 20100226 127.16000 127.22000 127.21000
22 12490 20100331 128.25000 128.30000 128.25999
23 12490 20100430 129.00000 128.89000 128.86000
24 12490 20100528 125.26000 125.17000 125.08000
25 12490 20100630 123.48000 123.41000 123.38000


Note: This procedure is experimental.