The DATASOURCE Procedure

Example 13.3 BLS State and Area Employment, Hours, and Earnings Surveys

This example illustrates how to extract specific series from a State and Area Employment, Hours, and Earnings Survey. The series to be extracted is total employment in real estate and construction industries with respect to states from March 1989 to March 1990.

The State and Area, Employment, Hours and Earnings survey designates the totals for statewide figures by AREA=’0000’.

The data type code for total employment is reported to be 1. Therefore, the series name for this variable is SA1, since series names are constructed by adding an SA prefix to the data type codes given by BLS.

Output 13.3.1 and Output 13.3.2 show statewide figures for total employment (SA1) in many industries from March 1989 through March 1990.

filename ascifile "%sysget(DATASRC_DATA)blseesa.dat" RECFM=F LRECL=152;
proc datasource  filetype=blseesa
                 infile=ascifile
                 outall=totkey
                 out=totemp;
   keep sa1;
   range from 1989:3 to 1990:3;
   rename sa1=totemp;
run;

title1 'Information on Total Employment, OUTALL= Data Set';
proc print data=totkey;
run;

title1 'Total Employment, OUT= Data Set';
proc print data=totemp;
run;

Output 13.3.1: Printout of the OUTALL= Data Set for All BY Groups

Information on Total Employment, OUTALL= Data Set

Obs STATE AREA DIVISION INDUSTRY DETAIL NAME KEPT SELECTED TYPE LENGTH VARNUM BLKNUM LABEL FORMAT FORMATL FORMATD ST_DATE END_DATE NTIME NOBS NINRANGE STATEABB AREANAME INDTITLE S_CODE SEASON UNITS NDEC
1 5 2580 7 0000 1 totemp 1 1 1 5 7 3 ALL EMP   0 0 JAN1970 JUN1990 246 246 13 AR FAYETTEVILLE-SPRINGDALE FINANCE, INSURANCE, AND REAL ESTATE SAU0525807000011 U   1
2 6 0360 4 2039 6 totemp 1 1 1 5 7 6 ALL EMP   0 0 JAN1972 JUN1990 222 222 13 CA ANAHEIM-SANTA ANA CANNED, CURED, AND FROZEN FOODS SAU0603604203961 U   1
3 6 6000 4 2300 2 totemp 1 1 1 5 7 7 ALL EMP   0 0 JAN1972 JUN1990 222 222 13 CA OXNARD-VENTURA APPAREL AND OTHER TEXTILE PRODUCTS SAU0660004230021 U   1
4 6 7120 2 0000 1 totemp 1 1 1 5 7 8 ALL EMP   0 0 JAN1957 DEC1987 372 372 0 CA SALINAS-SEASIDE-MONTEREY CONSTRUCTION SAU0671202000011 U   1
5 10 0000 7 6102 6 totemp 1 1 1 5 7 10 ALL EMP   0 0 JAN1984 DEC1987 48 48 0 DE DELAWARE NONDEPOS. INSTNS. & SEC. & COM. BRKRS. SAU1000007610261 U   1
6 11 8840 6 5600 2 totemp 1 1 1 5 7 11 ALL EMP   0 0 JAN1972 JUN1990 222 222 13 DC WASHINGTON MSA APPAREL AND ACCESSORY STORES SAU1188406560021 U   1



filename datafile "%sysget(DATASRC_DATA)blseesa.dat" RECFM=F LRECL=152;
proc datasource  filetype=blseesa
                 outall=totkey
                 out=totemp;
   where industry='0000';
   keep sa1;
   range from 1989:3 to 1990:3;
   rename sa1=totemp;
run;

title1 'Total Employment for Real Estate and Construction, OUT= Data Set';
proc print data=totemp;
run;

Output 13.3.2: Printout of the OUT= Data Set for INDUSTRY=0000

Total Employment for Real Estate and Construction, OUT= Data Set

Obs STATE AREA DIVISION INDUSTRY DETAIL DATE totemp
1 5 2580 7 0000 1 MAR1989 16
2 5 2580 7 0000 1 APR1989 16
3 5 2580 7 0000 1 MAY1989 16
4 5 2580 7 0000 1 JUN1989 16
5 5 2580 7 0000 1 JUL1989 16
6 5 2580 7 0000 1 AUG1989 16
7 5 2580 7 0000 1 SEP1989 16
8 5 2580 7 0000 1 OCT1989 16
9 5 2580 7 0000 1 NOV1989 16
10 5 2580 7 0000 1 DEC1989 16
11 5 2580 7 0000 1 JAN1990 15
12 5 2580 7 0000 1 FEB1990 15
13 5 2580 7 0000 1 MAR1990 15



Note the following for this example:

  • When the INFILE= option is omitted, the fileref assigned to the BLSEESA file is the default value DATAFILE.

  • The FROM and TO values in the RANGE statement correspond to monthly data points since the INTERVAL= option defaults to MONTH for the BLSEESA filetype.