Comparing Different Ways of Accessing CCM Data

/*----------------------------------------------------------------

                    SAS Sample Library

        Name: crpex07.sas
 Description: Example program from SAS/ETS User's Guide,
              The SASECRSP Interface Engine
    Title: Comparing Different Ways of Accessing CCM Data  
  Product: SAS/ETS Software
     Keys: CCM data access, CRSPAccess, PERMNO, PERMCO, GVKEY
    Procs: SASECRSP
    Notes: Read this before you run this sample.                      
           The CRSP CCM database resides in the  CRSP_CST folder. You 
           must install your CRSP COMPUSTAT Merged data
           and define your Windows system environment  
           variable, CRSP_CST, to point to the physical path
           of your installed CRSP CCM database. Use the following
           form of the libname statement:         

libname crsp1a sasecrsp "%sysget(CRSP_CST)"
        setid=200
        permno=10083
        range='19870101-19900101';
----------------------------------------------------------------*/
title1 'Comparing various access methods for CCM data';
libname _all_ clear;

/* assign libnames for the three different access methods */
libname crsp1a sasecrsp "%sysget(CRSP_CST)"
        setid=200
        permno=10083
        range='19870101-19900101';

libname crsp1b sasecrsp "%sysget(CRSP_CST)"
        setid=200
        permco=8026
        range='19870101-19900101';

libname crsp2 sasecrsp "%sysget(CRSP_CST)"
        setid=200
        gvkey=11947 gvkey=15495
        range='19870101-19900101';
title2 'PERMNO=10083 access of CCM data';
title3 'Sales (Net)';

data permnoaccess;
  set crsp1a.iqitems(keep=gvkey rcaldt fiscaldt iq2);
run;

proc print data=permnoaccess;
run;
title2 'GVKEY=11947 and GVKEY=15495 access of CCM data';
title3 'Sales (Net)';

data gvkeyaccess;
  set crsp2.iqitems(keep=gvkey rcaldt fiscaldt iq2);
run;

proc print data=gvkeyaccess;
run;
title3 'LINK: Link information';
proc print data=crsp2.link;
run;

/* Show how PERMNO and PERMCO access are the same */
title4 'Proc compare of PERMNO vs. PERMCO access of CCM data';
proc compare base=crsp1a.iqitems compare=crsp1b.iqitems brief;
run;