Resources

Specifying Ranges for Individual Keys with the INSET= Option

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

                    SAS Sample Library

        Name: crpex05.sas
 Description: Example program from SAS/ETS User's Guide,
              The SASECRSP Interface Engine
    Title: Specifying Ranges for Individual Keys with the INSET= Option
  Product: SAS/ETS Software
     Keys: Stock data access, CRSPAccess, INSET= Option, PERMNO, Date Range
    Procs: SASECRSP
    Notes: Read this before you run this sample.
           The CRSP Stock database resides in the  CRSP_MSTK folder. You
           must install your CRSP Monthly Stock data
           and define your Windows system environment
           variable, CRSP_MSTK, to point to the physical path
           of your installed CRSP Stock database. Use the following
           form of the libname statement:

libname mstk2 sasecrsp "%sysget(CRSP_MSTK)"
        setid=20
        inset='testin2,PERMNO,PERMNO,DATE1,DATE2';
----------------------------------------------------------------*/
title2 'INSET=testin2 uses date ranges along with PERMNOs:';
title3 '10107, 12490, 14322, 25788';
title4 'Begin dates and end dates for each permno are used in the INSET';

data testin2;
   permno = 10107; date1 = 19980731; date2 = 19981231; output;
   permno = 12490; date1 = 19970101; date2 = 19971231; output;
   permno = 14322; date1 = 19950731; date2 = 19960131; output;
   permno = 25778; date1 = 19950101; date2 = 19950331; output;
run;

libname _all_ clear;
libname mstk2 sasecrsp "%sysget(CRSP_MSTK)"
        setid=20
        inset='testin2,PERMNO,PERMNO,DATE1,DATE2';

data b;
   set mstk2.prc;
run;

proc print data=b;
run;