BLS Consumer Price Index Surveys
/*--------------------------------------------------------------
SAS Sample Library
Name: datex02.sas
Description: Example program from SAS/ETS User's Guide,
The DATASOURCE Procedure
Title: BLS Consumer Price Index Surveys
Product: SAS/ETS Software
System: ALL
Keys: DATASOURCE data extraction from various sources
Procs: DATASOURCE
Data: sasmisc: blscpi1.data (DATASOURCE database files)
Notes: Read this before you run this sample.
The database resides in the ets/sasmisc folder. You
must copy the database to a writeable folder before
using it. Then define your Windows system environment
variable, DATASRC_DATA, to the path of your
writeable folder containing
the blscpi1.data file.
To assign a fileref to the external file to be processed,
use the following form of the filename statement:
filename datafile "%sysget(DATASRC_DATA)blscpi1.data" recfm=v lrecl=152;
--------------------------------------------------------------*/
options yearcutoff = 1900;
filename datafile "%sysget(DATASRC_DATA)blscpi1.data" recfm=v lrecl=152;
proc datasource filetype=blscpi
interval=mon
outselect=off
outby=cpikey(where=( upcase(areaname)
in ('NORTHEAST','NORTH CENTRAL','SOUTH','WEST')) )
outcont=cpicont(where= ( index( upcase(label), 'MEDICAL CARE' )) );
where survey='CU';
run;
title1 'OUTBY= Data Set, By AREANAME Selection';
proc print
data=cpikey;
run;
title1 'OUTCONT= Data Set, By LABEL Selection';
proc print
data=cpicont;
run;
options yearcutoff = 1900;
filename datafile "%sysget(DATASRC_DATA)blscpi1.data" recfm=v lrecl=152;
proc format;
value $areafmt '0100' = 'Northeast Region'
'0200' = 'North Central Region'
'0300' = 'Southern Region'
'0400' = 'Western Region';
run;
proc datasource filetype=blscpi interval=month
out=medical outall=medinfo;
where survey='CU' and area in ( '0100','0200','0300','0400' );
keep date a512;
range from 1988:9;
format area $areafmt.;
rename a512=medcare;
run;
title1 'Information on Medical Care Service, OUTALL= Data Set';
proc print
data=medinfo;
run;
title1 'Medical Care Service By Region, OUT= Data Set';
title2 'Range from September, 1988';
proc print
data=medical;
run;