Previous Page | Next Page

The SASECRSP Interface Engine

Example 33.4 Specifying Keys Using the INSET= Option

The INSET= option enables you to select any companies and/or issues you want data for. This example selects two CRSP Index Series from the Indices database, two companies from the CCM database, and four securities from the Stock database for data extraction. Note that because each CRSP database might be in a different location and has to be opened separately, a total of three different librefs are used, one for each database.

   data indices;
      indno=1000000; output;  /* NYSE Value-Weighted Market Index */
      indno=1000001; output;  /* NYSE Equal-Weighted Market Index */
   run;
   
   libname _all_ clear;
   libname ind2 sasecrsp "%sysget(CRSP_MSTK)"
           setid=420
           inset='indices,INDNO,INDNO'
           range='19990101-19990401';
   
   title2 'Total Returns for NYSE Value and Equal Weighted Market Indices';
   proc print data=ind2.tret label;
   run;

Output 33.4.1 shows the result of selecting two CRSP Index Series from the Indices database.

Output 33.4.1 IND Data Extracted Using INSET= Option
 
Total Returns for NYSE Value and Equal Weighted Market Indices

Obs INDNO CALDT TRET
1 1000000 19990129 0.012419
2 1000000 19990226 -0.024179
3 1000000 19990331 0.028591
4 1000001 19990129 -0.007822
5 1000001 19990226 -0.041127
6 1000001 19990331 0.015204

This example selects two companies from the CCM database.

   data companies;
      permco=8045;  output;  /* Oracle */
      permco=20483; output;  /* Citigroup */
   run;
   
   libname comp2 sasecrsp "%sysget(CRSP_CST)"
           setid=200
           inset='companies,PERMCO,PERMCO'
           range='20040101-20040531';
   
   title2 'Using the Link Info of Selected PERMCOs';
   proc print data=comp2.link label;
   run;
   
   title3 'To Show Dividends Per Share for Oracle and Citigroup';
   proc print data=comp2.div label;
   run;

Output 33.4.2 shows the result of selecting two companies from the CCM database by using the CCM LINK data and the INSET= option.

Output 33.4.2 CCM LINK Data Extracted By Using INSET= Option
 
Using the Link Info of Selected PERMCOs
To Show Dividends Per Share for Oracle and Citigroup

Obs GVKEY LINKDT LINKENDT NPERMNO NPERMCO LINKTYPE LINKFLAG
1 12142 19860312 20991231 10104 8045 LC BBB
2 3243 19861029 20991231 70519 20483 LC BBB

Output 33.4.3 shows the result of selecting two companies from the CCM database by using the CCM DIV data and the INSET= option.

Output 33.4.3 CCM DIV Data Extracted By Using INSET= Option
 
Using the Link Info of Selected PERMCOs
To Show Dividends Per Share for Oracle and Citigroup

Obs GVKEY CALDT DIV
1 12142 20040130 0.0000
2 12142 20040227 0.0000
3 12142 20040331 0.0000
4 12142 20040430 0.0000
5 12142 20040528 0.0000
6 3243 20040130 0.4000
7 3243 20040227 0.0000
8 3243 20040331 0.0000
9 3243 20040430 0.4000
10 3243 20040528 0.0000

This example selects three securities from the Stock database by using TICKERs in the INSET= option for data extraction.

   data securities;
      ticker='BAC'; output;  /* Bank of America */
      ticker='DUK'; output;  /* Duke Energy */
      ticker='GSK'; output;  /* GlaxoSmithKline */
   run;
   
   libname sec3 sasecrsp "%sysget(CRSP_MSTK)"
           setid=20
           inset='securities,TICKER,TICKER'
           range='19970820-19970920';
   
   title2 'PERMNOs and General Header Info of Selected TICKERs';
   proc print data=sec3.stkhead(keep=permno htick htsymbol) label;
   run;
   title3 'Average Price for Bank of America, Duke and GlaxoSmithKline';
   proc print data=sec3.prc label;
   run;

Output 33.4.4 shows the STK header data for the TICKERs specified by using the INSET= option.

Output 33.4.4 STK Header Data Extracted Using INSET= Option
 
PERMNOs and General Header Info of Selected TICKERs
Average Price for Bank of America, Duke and GlaxoSmithKline

Obs PERMNO PERMCO COMPNO ISSUNO HEXCD HSHRCD HSICCD BEGDT ENDDT DLSTCD HCUSIP HTICK HCOMNAM HTSYMBOL HNAICS HPRIMEXC HTRDSTAT HSECSTAT
1 59408 3151 60003150 4005 1 11 6021 19721229 20061229 100 06050510 BAC BANK OF AMERICA CORP BAC 522110 N A R
2 27959 20608 0 0 1 11 4911 19610731 20061229 100 26441C10 DUK DUKE ENERGY CORP NEW DUK 221122 N A R
3 75064 1973 60001972 2523 1 31 2834 19721229 20061229 100 37733W10 GSK GLAXOSMITHKLINE PLC GSK 325412 N A R

Output 33.4.5 shows the STK price data for the TICKERs specified by using the INSET= option.

Output 33.4.5 STK Price Data Extracted Using INSET= Option
 
PERMNOs and General Header Info of Selected TICKERs
Average Price for Bank of America, Duke and GlaxoSmithKline

Obs PERMNO CALDT PRC
1 59408 19970829 59.75000
2 27959 19970829 48.43750
3 75064 19970829 39.93750


Previous Page | Next Page | Top of Page