DATASOURCE Procedure

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

(View the complete code for this example.)

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 12.3.1 and Output 12.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 12.3.1: Printout of the OUTALL= Data Set for All BY Groups

Information on Total Employment, OUTALL= Data Set

ObsSTATEAREADIVISIONINDUSTRYDETAILNAMEKEPTSELECTEDTYPELENGTHVARNUMBLKNUMLABELFORMATFORMATLFORMATDST_DATEEND_DATENTIMENOBSNINRANGESTATEABBAREANAMEINDTITLES_CODESEASONUNITSNDEC
152580700001totemp111573ALL EMP 00JAN1970JUN199024624613ARFAYETTEVILLE-SPRINGDALEFINANCE, INSURANCE, AND REAL ESTATESAU0525807000011U 1
260360420396totemp111576ALL EMP 00JAN1972JUN199022222213CAANAHEIM-SANTA ANACANNED, CURED, AND FROZEN FOODSSAU0603604203961U 1
366000423002totemp111577ALL EMP 00JAN1972JUN199022222213CAOXNARD-VENTURAAPPAREL AND OTHER TEXTILE PRODUCTSSAU0660004230021U 1
467120200001totemp111578ALL EMP 00JAN1957DEC19873723720CASALINAS-SEASIDE-MONTEREYCONSTRUCTIONSAU0671202000011U 1
5100000761026totemp1115710ALL EMP 00JAN1984DEC198748480DEDELAWARENONDEPOS. INSTNS. & SEC. & COM. BRKRS.SAU1000007610261U 1
6118840656002totemp1115711ALL EMP 00JAN1972JUN199022222213DCWASHINGTON MSAAPPAREL AND ACCESSORY STORESSAU1188406560021U 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 12.3.2: Printout of the OUT= Data Set for INDUSTRY=0000

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

ObsSTATEAREADIVISIONINDUSTRYDETAILDATEtotemp
152580700001MAR198916
252580700001APR198916
352580700001MAY198916
452580700001JUN198916
552580700001JUL198916
652580700001AUG198916
752580700001SEP198916
852580700001OCT198916
952580700001NOV198916
1052580700001DEC198916
1152580700001JAN199015
1252580700001FEB199015
1352580700001MAR199015


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.

Last updated: June 19, 2025