The SASECRSP Interface Engine

Example 39.8 Comparing PERMNO and GVKEY Access of CRSP Stock Data

You can access CRSP data using GVKEYs. Access in this manner requires the use of the CRSPLINKPATH= option, and is identical to access by its corresponding PERMNO(s). Links between PERMNOs and GVKEYs are used without reference to their active period. Link information is used solely for finding corresponding GVKEYs. This example shows two ways of accessing CRSP Stock data: one by PERMNOs and the other by its corresponding GVKEY. Several members are compared, showing they are equivalent.

title 'Comparing PERMNO and GVKEY access of CRSP Stock data';

libname _all_ clear;
libname crsp1 sasecrsp "%sysget(CRSP_MSTK)"
        setid=20
        permno=13638 permno=84641
        range='19900101-19910101';

libname crsp2 sasecrsp "%sysget(CRSP_MSTK)"
        setid=20
        crsplinkpath="%sysget(CRSP_CST)"
        gvkey=1544
        range='19900101-19910101';

title1 'PERMNO=13638 and PERMNO=84641 access of CRSP data';
proc print data=crsp1.stkhead;
run;

%macro compareMember(memb);
   title1 "Proc compare on &memb between PERMNO and GVKEY";
   proc compare base=crsp1.&memb compare=crsp2.&memb brief;
   run;
%mend;

%compareMember(stkhead);
%compareMember(prc);
%compareMember(ret);
%compareMember(askhi);
%compareMember(vol);

Output 39.8.1 compares PERMNO with GVKEY access of CRSP Stock members STKHEAD, PRC, RET, ASKHI, AND VOL, showing that they are equal.

Output 39.8.1: Comparing PERMNO and GVKEY Access of CRSP Stock Data

PERMNO=13638 and PERMNO=84641 access of CRSP data

Obs PERMNO PERMCO COMPNO ISSUNO HEXCD HSHRCD HSICCD BEGDT ENDDT DLSTCD HCUSIP HTICK HCOMNAM HTSYMBOL HNAICS HPRIMEXC HTRDSTAT HSECSTAT
1 13638 325 60000324 428 3 11 1310 19721229 19921231 560 97789210   WOLVERINE EXPLORATION CO WEXC   Q A R
2 84641 325 60000324 0 2 11 1382 19970331 19980130 231 02351730   AMERAC ENERGY CORP     A A R

Proc compare on stkhead between PERMNO and GVKEY

                             The COMPARE Procedure                              
                 Comparison of CRSP1.STKHEAD with CRSP2.STKHEAD                 
                                 (Method=EXACT)                                 
                                                                                
NOTE: No unequal values were found. All values compared are exactly equal.      

Proc compare on prc between PERMNO and GVKEY

                             The COMPARE Procedure                              
                     Comparison of CRSP1.PRC with CRSP2.PRC                     
                                 (Method=EXACT)                                 
                                                                                
NOTE: No unequal values were found. All values compared are exactly equal.      

Proc compare on ret between PERMNO and GVKEY

                             The COMPARE Procedure                              
                     Comparison of CRSP1.RET with CRSP2.RET                     
                                 (Method=EXACT)                                 
                                                                                
NOTE: No unequal values were found. All values compared are exactly equal.      

Proc compare on askhi between PERMNO and GVKEY

                             The COMPARE Procedure                              
                   Comparison of CRSP1.ASKHI with CRSP2.ASKHI                   
                                 (Method=EXACT)                                 
                                                                                
NOTE: No unequal values were found. All values compared are exactly equal.      

Proc compare on vol between PERMNO and GVKEY

                             The COMPARE Procedure                              
                     Comparison of CRSP1.VOL with CRSP2.VOL                     
                                 (Method=EXACT)                                 
                                                                                
NOTE: No unequal values were found. All values compared are exactly equal.