SASEBLS Interface Engine
Example 23.9 Retrieving Quarterly Census of Employment and Wages (QCEW) Data
This example shows how to retrieve data from the Quarterly Census of Employment and Wages surveys. You can view these data by using the following URL:
https://www.bls.gov/cew/data-overview.htm
INSERIES is an input SAS data set that lists the IDs of the time series to be retrieved from the Quarterly Census of Employment and Wages (QCEW) 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 2019, as specified by the STARTYEAR= option. The ENDYEAR= option specifies the last year, 2020, 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. No catalog is available for the selected QCEW data in this example, so the description of each time series can be obtained by using the series ID format described at the following URL:
https://www.bls.gov/help/hlpforma.htm#EN
These descriptions can be placed in the label for each time series, as shown in the LABEL statements in the myQCEW DATA step.
The FORMAT= option specifies that the data are to be retrieved using the JSON format. Output 23.9.1 shows the data that are retrieved.
options;
DATA inseries;
length seriesid $ 32;
seriesid = 'ENU0603710010'; output; /* Los Angeles County */
seriesid = 'ENU0607310010'; output; /* San Diego County */
RUN;
title 'Retrieve State and County Employment and Wages Data';
libname bls sasebls "%sysget(BLS)"
USER='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
SETNAME=QCEW
INSET=inseries
PAYPATH= "%sysget(BLS)payload"
OUTJSON=blsex09
STARTYEAR='2019'
ENDYEAR='2020'
FREQ=Month
CALCULATIONS=true
FORMAT=json;
data myQCEW;
set bls.blsex09;
label ENU0603710010=
'All employees, industries, and establishment sizes in Los Angeles County, NSA';
label ENU0607310010=
'All employees, industries, and establishment sizes in San Diego County, NSA';
run;
proc contents data=myQCEW; run;
proc print data=myQCEW; run;
Output 23.9.1: State and County Employment and Wages, Los Angeles and San Diego
| Retrieve State and County Employment and Wages Data |
| Obs | year | period | periodName | ENU0603710010 | ENU0603710010_1 | ENU0603710010_3 | ENU0603710010_6 | ENU0603710010_12 | ENU0603710010%1 | ENU0603710010%3 | ENU0603710010%6 | ENU0603710010%12 | ENU0607310010 | ENU0607310010_1 | ENU0607310010_3 | ENU0607310010_6 | ENU0607310010_12 | ENU0607310010%1 | ENU0607310010%3 | ENU0607310010%6 | ENU0607310010%12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2019 | M01 | January | 4441945 | -84249 | -42840 | 47637 | 58390 | -1.9 | -1.0 | 1.1 | 1.3 | 1461494 | -24183 | -15211 | 3363 | 23556 | -1.6 | -1.0 | 0.2 | 1.6 |
| 2 | 2019 | M02 | February | 4503959 | 62014 | -24444 | 74733 | 66479 | 1.4 | -0.5 | 1.7 | 1.5 | 1470634 | 9140 | -14836 | 9012 | 21659 | 0.6 | -1.0 | 0.6 | 1.5 |
| 3 | 2019 | M03 | March | 4488329 | -15630 | -37865 | 37896 | 66546 | -0.3 | -0.8 | 0.9 | 1.5 | 1474284 | 3650 | -11393 | 8050 | 22357 | 0.2 | -0.8 | 0.5 | 1.5 |
| 4 | 2019 | M04 | April | 4476946 | -11383 | 35001 | -7839 | 57017 | -0.3 | 0.8 | -0.2 | 1.3 | 1482234 | 7950 | 20740 | 5529 | 21656 | 0.5 | 1.4 | 0.4 | 1.5 |
| 5 | 2019 | M05 | May | 4504394 | 27448 | 435 | -24009 | 72814 | 0.6 | 0.0 | -0.5 | 1.6 | 1487525 | 5291 | 16891 | 2055 | 23090 | 0.4 | 1.1 | 0.1 | 1.6 |
| 6 | 2019 | M06 | June | 4501170 | -3224 | 12841 | -25024 | 59703 | -0.1 | 0.3 | -0.6 | 1.3 | 1492516 | 4991 | 18232 | 6839 | 20705 | 0.3 | 1.2 | 0.5 | 1.4 |
| 7 | 2019 | M07 | July | 4453145 | -48025 | -23801 | 11200 | 58837 | -1.1 | -0.5 | 0.3 | 1.3 | 1479095 | -13421 | -3139 | 17601 | 20964 | -0.9 | -0.2 | 1.2 | 1.4 |
| 8 | 2019 | M08 | August | 4485820 | 32675 | -18574 | -18139 | 56594 | 0.7 | -0.4 | -0.4 | 1.3 | 1488846 | 9751 | 1321 | 18212 | 27224 | 0.7 | 0.1 | 1.2 | 1.9 |
| 9 | 2019 | M09 | September | 4512698 | 26878 | 11528 | 24369 | 62265 | 0.6 | 0.3 | 0.5 | 1.4 | 1491789 | 2943 | -727 | 17505 | 25555 | 0.2 | 0.0 | 1.2 | 1.7 |
| 10 | 2019 | M10 | October | 4547597 | 34899 | 94452 | 70651 | 62812 | 0.8 | 2.1 | 1.6 | 1.4 | 1503857 | 12068 | 24762 | 21623 | 27152 | 0.8 | 1.7 | 1.5 | 1.8 |
| 11 | 2019 | M11 | November | 4608275 | 60678 | 122455 | 103881 | 79872 | 1.3 | 2.7 | 2.3 | 1.8 | 1515570 | 11713 | 26724 | 28045 | 30100 | 0.8 | 1.8 | 1.9 | 2.0 |
| 12 | 2019 | M12 | December | 4594584 | -13691 | 81886 | 93414 | 68390 | -0.3 | 1.8 | 2.1 | 1.5 | 1511523 | -4047 | 19734 | 19007 | 25846 | -0.3 | 1.3 | 1.3 | 1.7 |
| 13 | 2020 | M01 | January | 4509613 | -84971 | -37984 | 56468 | 67668 | -1.8 | -0.8 | 1.3 | 1.5 | 1487837 | -23686 | -16020 | 8742 | 26343 | -1.6 | -1.1 | 0.6 | 1.8 |
| 14 | 2020 | M02 | February | 4577042 | 67429 | -31233 | 91222 | 73083 | 1.5 | -0.7 | 2.0 | 1.6 | 1500138 | 12301 | -15432 | 11292 | 29504 | 0.8 | -1.0 | 0.8 | 2.0 |
| 15 | 2020 | M03 | March | 4483235 | -93807 | -111349 | -29463 | -5094 | -2.0 | -2.4 | -0.7 | -0.1 | 1484848 | -15290 | -26675 | -6941 | 10564 | -1.0 | -1.8 | -0.5 | 0.7 |
| 16 | 2020 | M04 | April | 3768970 | -714265 | -740643 | -778627 | -707976 | -15.9 | -16.4 | -17.1 | -15.8 | 1248648 | -236200 | -239189 | -255209 | -233586 | -15.9 | -16.1 | -17.0 | -15.8 |
| 17 | 2020 | M05 | May | 3833794 | 64824 | -743248 | -774481 | -670600 | 1.7 | -16.2 | -16.8 | -14.9 | 1262659 | 14011 | -237479 | -252911 | -224866 | 1.1 | -15.8 | -16.7 | -15.1 |
| 18 | 2020 | M06 | June | 3935879 | 102085 | -547356 | -658705 | -565291 | 2.7 | -12.2 | -14.3 | -12.6 | 1321639 | 58980 | -163209 | -189884 | -170877 | 4.7 | -11.0 | -12.6 | -11.4 |
| 19 | 2020 | M07 | July | 3911445 | -24434 | 142475 | -598168 | -541700 | -0.6 | 3.8 | -13.3 | -12.2 | 1313914 | -7725 | 65266 | -173923 | -165181 | -0.6 | 5.2 | -11.7 | -11.2 |
| 20 | 2020 | M08 | August | 3930529 | 19084 | 96735 | -646513 | -555291 | 0.5 | 2.5 | -14.1 | -12.4 | 1329040 | 15126 | 66381 | -171098 | -159806 | 1.2 | 5.3 | -11.4 | -10.7 |
| 21 | 2020 | M09 | September | 3991837 | 61308 | 55958 | -491398 | -520861 | 1.6 | 1.4 | -11.0 | -11.5 | 1349606 | 20566 | 27967 | -135242 | -142183 | 1.5 | 2.1 | -9.1 | -9.5 |
| 22 | 2020 | M10 | October | 4098577 | 106740 | 187132 | 329607 | -449020 | 2.7 | 4.8 | 8.7 | -9.9 | 1378764 | 29158 | 64850 | 130116 | -125093 | 2.2 | 4.9 | 10.4 | -8.3 |
| 23 | 2020 | M11 | November | 4155559 | 56982 | 225030 | 321765 | -452716 | 1.4 | 5.7 | 8.4 | -9.8 | 1387139 | 8375 | 58099 | 124480 | -128431 | 0.6 | 4.4 | 9.9 | -8.5 |
| 24 | 2020 | M12 | December | 4115123 | -40436 | 123286 | 179244 | -479461 | -1.0 | 3.1 | 4.6 | -10.4 | 1370022 | -17117 | 20416 | 48383 | -141501 | -1.2 | 1.5 | 3.7 | -9.4 |