SASEBLS Interface Engine
Example 23.17 Retrieving Local Area Unemployment Statistics (LAUS) Data
This example shows how to retrieve data from the Local Area Unemployment Statistics (LAUS) program. You can view these data by using the following URL:
https://www.bls.gov/lau/data.htm
INSERIES is an input SAS data set that lists the time series IDs to be read from the Local Area Unemployment Statistics (LAUS) program 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 IDs to retrieve. In this example, three time series are requested, along with the catalog (CATALOG=TRUE option).
The date range of the data starts with 2022, as specified by the STARTYEAR= option. The ENDYEAR= option specifies the last year, 2023, to include in the range of data to retrieve. The FREQ=MONTHLY option specifies the selection of monthly data, and because the CATALOG=TRUE option is specified, the retrieved data also include available catalog information.
The FORMAT= option specifies that the data are to be retrieved using the JSON format. Output 23.17.1 shows the selected monthly data that are retrieved. Output 23.17.2 shows the catalog information for the retrieved data. The data from the three retrieved time series come from three different metropolitan statistical areas (MSAs).
options;
libname blscat "%sysget(BLS)"; /* for Catalog data set*/
DATA inseries;
length seriesid $ 32;
seriesid = 'LAUMT373958000000003'; output; /* Raleigh, NC MSA*/
seriesid = 'LAUMT064174000000003'; output; /* San Diego-Carlsbad, CA MSA*/
seriesid = 'LAUMT364506000000003'; output; /* Syracuse, NY MSA*/
RUN;
title 'Retrieve Local Area Unemployment Statistics Data';
libname bls sasebls "%sysget(BLS)"
USER='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
SETNAME=LAUS
INSET=inseries
PAYPATH= "%sysget(BLS)payload"
OUTJSON=blsex17
STARTYEAR='2022'
ENDYEAR='2023'
FREQ=Monthly
CATALOG=true
FORMAT=json;
data myLAUS;
set bls.blsex17 ;
label LAUMT373958000000003='Raleigh, NC MSA, unemployment rate';
label LAUMT064174000000003='San Diego-Carlsbad, CA MSA, unemployment rate';
label LAUMT364506000000003='Syracuse, NY MSA, unemployment rate';
run;
proc print data=myLAUS; run;
Output 23.17.1: Local Area Unemployment Rate
| Retrieve Local Area Unemployment Statistics Data |
| Obs | year | period | periodName | LAUMT064174000000003 | LAUMT364506000000003 | LAUMT373958000000003 |
|---|---|---|---|---|---|---|
| 1 | 2022 | M01 | January | 4.6 | 4.0 | 3.3 |
| 2 | 2022 | M02 | February | 4.1 | 4.2 | 3.1 |
| 3 | 2022 | M03 | March | 3.6 | 3.7 | 2.9 |
| 4 | 2022 | M04 | April | 3.2 | 3.2 | 2.8 |
| 5 | 2022 | M05 | May | 2.9 | 3.1 | 3.1 |
| 6 | 2022 | M06 | June | 3.4 | 3.4 | 3.4 |
| 7 | 2022 | M07 | July | 3.4 | 3.6 | 3.3 |
| 8 | 2022 | M08 | August | 3.5 | 3.7 | 3.6 |
| 9 | 2022 | M09 | September | 3.1 | 3.0 | 3.0 |
| 10 | 2022 | M10 | October | 3.3 | 2.8 | 3.2 |
| 11 | 2022 | M11 | November | 3.3 | 3.0 | 3.1 |
| 12 | 2022 | M12 | December | 3.0 | 3.2 | 2.7 |
| 13 | 2023 | M01 | January | 3.7 | 4.1 | 3.1 |
| 14 | 2023 | M02 | February | 3.7 | 3.8 | 3.1 |
| 15 | 2023 | M03 | March | 3.7 | 3.4 | 3.1 |
| 16 | 2023 | M04 | April | 3.3 | 2.6 | 2.8 |
The following statements print the catalog information shown in Output 23.17.2:
libname blscat "%sysget(BLS)";
data myCAT;
set blscat.blsex17_catalog;
run;
proc print data=myCAT; run;
Output 23.17.2: Catalog for Local Area Unemployment Rate
| Retrieve Local Area Unemployment Statistics Data |
| Obs | ordinal_series | ordinal_catalog | series_title | series_id | seasonality | survey_name | survey_abbreviation | measure_data_type | area | area_type |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 1 | Unemployment Rate: San Diego-Carlsbad, CA Metropolitan Statistical Area (U) | LAUMT064174000000003 | Not Seasonally Adjusted | Local Area Unemployment Statistics | LA | unemployment rate | San Diego-Carlsbad, CA Metropolitan Statistical Area | Metropolitan areas |
| 2 | 2 | 2 | Unemployment Rate: Syracuse, NY Metropolitan Statistical Area (U) | LAUMT364506000000003 | Not Seasonally Adjusted | Local Area Unemployment Statistics | LA | unemployment rate | Syracuse, NY Metropolitan Statistical Area | Metropolitan areas |
| 3 | 3 | 3 | Unemployment Rate: Raleigh, NC Metropolitan Statistical Area (U) | LAUMT373958000000003 | Not Seasonally Adjusted | Local Area Unemployment Statistics | LA | unemployment rate | Raleigh, NC Metropolitan Statistical Area | Metropolitan areas |