SASEBLS Interface Engine
Example 23.13 Retrieving Employment Projections (EPP) Data
This example shows how to retrieve Employment Projections (EPP) data. You can view these data by using the following URL:
https://www.bls.gov/emp/data.htm
INSERIES is an input SAS data set that lists the IDs of the time series to be read from the EP database. In this example, the input SAS data set is named in the INSET=INSERIES option. To create the INSERIES data set, use the DATA step. In the DATA statement, the name of the input data set is specified as 'INSERIES'. Next, the length of the series ID is specified as 32 bytes prior to listing each series ID to be accessed. Each time series is listed on its own line, along with the OUTPUT statement. When the series IDs have been listed, the DATA step is ended with a RUN statement. The following SASEBLS LIBNAME statement specifies the libref (BLS), followed by the engine name (SASEBLS) and the physical path where the retrieved BLS data are to be stored. The OUTJSON= option names the file where the JSON data are stored. The output data set is created using the OUTJSON= option and placed in the folder that is specified in the SASEBLS LIBNAME statement. The INSET= option specifies the INSERIES data set for the list of series to retrieve using their IDs. In this example, four time series are requested, along with any calculations. Employment Projections data are available for only one year, so the date range is specified for that year. The date range of the data starts with 2021, as specified by the STARTYEAR= option. The ENDYEAR= option specifies the last year, 2021, to include in the range of data to retrieve. The FREQ=ANNUAL (or FREQ=A) option specifies the selection of annual data. There is no catalog for the EPP data set, so the description of each time series can be obtained from the series_title column at the following URL:
https://download.bls.gov/pub/time.series/ep/ep.series
You can place these descriptions in the label for each time series, as shown in the LABEL statements of the myEPP DATA step.
The FORMAT= option specifies that the data are to be retrieved using the JSON format. Output 23.13.1 shows the data that are retrieved.
options;
DATA inseries;
length seriesid $ 32;
seriesid = 'EPU000000110000'; output;
seriesid = 'EPU000000220000'; output;
seriesid = 'EPU000000230000'; output;
seriesid = 'EPU000000324000'; output;
RUN;
title 'Retrieve Employment Projections Data';
libname bls sasebls "%sysget(BLS)"
USER='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
SETNAME=EPP
INSET=inseries
PAYPATH= "%sysget(BLS)payload"
OUTJSON=blsex13
STARTYEAR='2021'
ENDYEAR='2021'
FREQ=Annual
FORMAT=json;
data myEPP;
set bls.blsex13;
label EPU000000110000=
'Total, all occupations in mining, quarrying, oil and gas extraction';
label EPU000000220000='Total, all occupations in Utilities';
label EPU000000230000='Total, all occupations in Construction';
label EPU000000324000='Total, all occupations in Petroleum and coal';
run;
proc contents data=myEPP; run;
proc print data=myEPP; run;
Output 23.13.1: Employment Projections Data
| Retrieve Employment Projections Data |
| Obs | year | period | periodName | EPU000000110000 | EPU000000220000 | EPU000000230000 | EPU000000324000 |
|---|---|---|---|---|---|---|---|
| 1 | 2021 | A01 | Annual | 1460.2 | 540.8 | 7413.1 | 105.6 |