SASEBLS Interface Engine
Example 23.8 Retrieving Job Openings and Labor Turnover Statistics (JOLT) Data
This example shows how to retrieve data from the Job Openings and Labor Turnover Surveys, JT and JL. You can view these data by using the following URL:
https://www.bls.gov/jlt
INSERIES is an input SAS data set that lists the IDs of the time series to be retrieved from the Job Openings and Labor Turnover Statistics 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 the ID of each series 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.
The date range of the data starts with 2002, as specified by the STARTYEAR= option. The ENDYEAR= option specifies the last year, 2003, to include in the range of data to retrieve. The FREQ=MONTH option specifies the selection of monthly data, but because the CALCULATIONS=TRUE option is specified, the retrieved data also include the net change calculation and percentage change calculation statistics. There is no catalog for the JOLT data set, so the description of each statistical time series can be obtained by the seriesid format described at the following URL:
https://www.bls.gov/help/hlpforma.htm#jt
These descriptions can be placed in the label for each time series as shown in the label statements of the myJOLT DATA STEP.
The FORMAT= option specifies that the data are to be retrieved using the JSON format. For brevity, only the first four observations are shown in Output 23.8.1.
options;
DATA inseries;
length seriesid $ 32;
seriesid = 'JLU000000MWHIL'; output; /* Total Nonfarm Hires (SIC based) */
seriesid = 'JLU91000000TSR'; output; /* Federal Total Separations (SIC based)*/
seriesid = 'JTS000000000000000HIL'; output; /* Total Nonfarm Hires */
seriesid = 'JTU929000000000000LDL'; output; /* Govt. Layoffs and Discharges */
RUN;
title 'Retrieve Job Openings and Labor Turnover Statistics Data';
libname bls sasebls "%sysget(BLS)"
USER='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
SETNAME=JOLT
INSET=inseries
PAYPATH= "%sysget(BLS)payload"
OUTJSON=blsex08
STARTYEAR='2002'
ENDYEAR='2003'
FREQ=Month
CALCULATIONS=true
FORMAT=json;
data myJOLT;
set bls.blsex08 ;
label JLU000000MWHIL='Total Nonfarm Hires (SIC based)';
label JLU91000000TSR='Federal Total Separations (SIC based)';
label JTS000000000000000HIL='Total Nonfarm Hires';
label JTU929000000000000LDL='State and Local Government Layoffs and Discharges';
run;
proc contents data=myJOLT; run;
proc print data=myJOLT(obs=4); run;
Output 23.8.1: Job Openings and Labor Turnover Statistics
| Retrieve Job Openings and Labor Turnover Statistics Data |
| Obs | year | period | periodName | JLU000000MWHIL | JLU000000MWHIL_1 | JLU000000MWHIL_3 | JLU000000MWHIL_6 | JLU000000MWHIL_12 | JLU000000MWHIL%1 | JLU000000MWHIL%3 | JLU000000MWHIL%6 | JLU000000MWHIL%12 | JLU91000000TSR | JLU91000000TSR_1 | JLU91000000TSR_3 | JLU91000000TSR_6 | JLU91000000TSR_12 | JLU91000000TSR%1 | JLU91000000TSR%3 | JLU91000000TSR%6 | JLU91000000TSR%12 | JTS000000000000000HIL | JTS000000000000000HIL_1 | JTS000000000000000HIL_3 | JTS000000000000000HIL_6 | JTS000000000000000HIL_12 | JTS000000000000000HIL%1 | JTS000000000000000HIL%3 | JTS000000000000000HIL%6 | JTS000000000000000HIL%12 | JTU929000000000000LDL | JTU929000000000000LDL_1 | JTU929000000000000LDL_3 | JTU929000000000000LDL_6 | JTU929000000000000LDL_12 | JTU929000000000000LDL%1 | JTU929000000000000LDL%3 | JTU929000000000000LDL%6 | JTU929000000000000LDL%12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2002 | M01 | January | 738 | 18 | -345 | -343 | -294 | 2.5 | -31.9 | -31.7 | -28.5 | 1.5 | -0.2 | 0.0 | -0.1 | -0.4 | -11.8 | 0.0 | -6.3 | -21.1 | 4855 | 26 | -223 | -389 | -867 | 0.5 | -4.4 | -7.4 | -15.2 | 31 | -3 | -36 | 1 | -2 | -8.8 | -53.7 | 3.3 | -6.1 |
| 2 | 2002 | M02 | February | 744 | 6 | -38 | -534 | -162 | 0.8 | -4.9 | -41.8 | -17.9 | 1.3 | -0.2 | 0.2 | -0.4 | -0.1 | -13.3 | 18.2 | -23.5 | -7.1 | 4801 | -54 | -113 | -422 | -502 | -1.1 | -2.3 | -8.1 | -9.5 | 29 | -2 | -5 | -114 | 2 | -6.5 | -14.7 | -79.7 | 7.4 |
| 3 | 2002 | M03 | March | 832 | 88 | 112 | -462 | -270 | 11.8 | 15.6 | -35.7 | -24.5 | 1.3 | 0.0 | -0.4 | -0.4 | 0.4 | 0.0 | -23.5 | -23.5 | 44.4 | 4706 | -95 | -123 | -248 | -822 | -2.0 | -2.5 | -5.0 | -14.9 | 21 | -8 | -13 | -83 | -5 | -27.6 | -38.2 | -79.8 | -19.2 |
| 4 | 2002 | M04 | April | 1173 | 341 | 435 | 90 | -76 | 41.0 | 58.9 | 8.3 | -6.1 | 1.2 | -0.1 | -0.3 | -0.3 | 0.1 | -7.7 | -20.0 | -20.0 | 9.1 | 4928 | 222 | 73 | -150 | -276 | 4.7 | 1.5 | -3.0 | -5.3 | 43 | 22 | 12 | -24 | -5 | 104.8 | 38.7 | -35.8 | -10.4 |