Using INSET Ranges with the LIBNAME RANGE Option
/*----------------------------------------------------------------
SAS Sample Library
Name: crpex11.sas
Description: Example program from SAS/ETS User's Guide,
The SASECRSP Interface Engine
Title: Using INSET Ranges with the LIBNAME RANGE Option
Product: SAS/ETS Software
Keys: CCM data access, CRSPAccess, Date range, INSET= option
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 mylib sasecrsp "%sysget(CRSP_CST)"
SETID=200
INSET='two_companies,gvkey,gvkey,date1,date2'
RANGE='19990801-20020421';
----------------------------------------------------------------*/
data two_companies;
gvkey=6066; date1=19800101; date2=20000201; output;
gvkey=12141; date1=20010101; date2=20051231; output;
run;
libname _all_ clear;
libname mylib sasecrsp "%sysget(CRSP_CST)"
SETID=200
INSET='two_companies,gvkey,gvkey,date1,date2'
RANGE='19990801-20020421';
title1 'Two Companies, Two Range Selections';
title2 'Global RANGE Statement Used With Individual Inset Ranges';
title3 'Results Show Intersection of Both Range Restrictions';
proc sql;
select prcc.gvkey,prcc.caldt,prcc,ern
from mylib.prcc as prcc, mylib.ern as ern
where prcc.caldt = ern.caldt and
prcc.gvkey = ern.gvkey;
quit;