The SASEBLS Interface Engine

Example 20.5 Retrieving Current Employment Statistics National Survey (CE) Data

This example shows how to retrieve data from the Current Employment Statistics Survey (CE). You can view these data by using the following URL:

https://www.bls.gov/ces/data/

INSERIES is an input SAS data set that lists the time series IDs to be read from the Current Employment Statistics (CES) 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, two time series, CES0000000001 and CEU0500000001, are requested, along with any calculations. Both time series have 1-month, 3-month, 6-month, and 12-month net and percentage changes.

The date range of the data starts with 2003, as specified by the STARTYEAR= option. The ENDYEAR= option specifies the last year, 2004, 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. Because the ANNUALAVERAGE=TRUE option is specified, the output should include the annual average M13 data, but in this example only one of the requested time series, CEU0500000001, has data for the M13 frequency. The FORMAT= option specifies that the data are to be retrieved using the JSON format. Output 20.5.1 shows the data that are retrieved.


options validvarname=any;

DATA inseries;
   length seriesid $ 32;
   seriesid = 'CES0000000001'; output; /* All employees */
   seriesid = 'CEU0500000001'; output;

RUN;

title 'Retrieve Current Employment Statistics Data';
libname bls sasebls "%sysget(BLS)"
   USER='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   SETNAME=CES
   INSET=inseries
   PAYPATH= "%sysget(BLS)payload"
   OUTJSON=blsex05
   STARTYEAR='2003'
   ENDYEAR='2004'
   FREQ=Month
   CALCULATIONS=true
   ANNUALAVERAGE=true
   CATALOG=true
   FORMAT=json;

data myCES;
   set bls.blsex05 ;
run;

proc print data=myCES; run;

Output 20.5.1: All Seasonally Adjusted Non-farm Employees and All Not Seasonally Adjusted Private Employees

Retrieve Current Employment Statistics Data

ObsyearperiodperiodNameCES0000000001CES0000000001_1CES0000000001_3CES0000000001_6CES0000000001_12CES0000000001%1CES0000000001%3CES0000000001%6CES0000000001%12CEU0500000001CEU0500000001_1CEU0500000001_3CEU0500000001_6CEU0500000001_12CEU0500000001%1CEU0500000001%3CEU0500000001%6CEU0500000001%12
12003M01January130580108-48-10-2720.10.00.0-0.2107019-2267-2633-2869-557-2.1-2.4-2.6-0.5
22003M02February130444-136-171-143-292-0.1-0.1-0.1-0.210705334-2582-2891-5830.0-2.4-2.6-0.5
32003M03March130232-212-240-269-485-0.2-0.2-0.2-0.4107457404-1829-2038-6610.4-1.7-1.9-0.6
42003M04April130177-55-403-451-4460.0-0.3-0.3-0.31081326751113-1520-5650.61.0-1.4-0.5
52003M05May13019619-248-419-4380.0-0.2-0.3-0.31089067741853-729-4610.71.7-0.7-0.4
62003M06June130194-2-38-278-4900.00.0-0.2-0.41096357292178349-5190.72.00.3-0.5
72003M07July130191-314-389-3990.00.0-0.3-0.3109437-19813052418-451-0.21.22.3-0.4
82003M08August130149-42-47-295-4380.00.0-0.2-0.3109534976282481-4100.10.62.3-0.4
92003M09September1302541056022-2470.10.00.0-0.2109263-271-3721806-232-0.2-0.31.7-0.2
102003M10October130454200263277-1740.20.20.2-0.1109513250761381-1390.20.11.3-0.1
112003M11November13047420325278-1410.00.20.2-0.11095695635663-660.10.00.6-0.1
122003M12December1305881143343941160.10.30.30.1109454-115191-181168-0.10.2-0.20.2
132003M13Annual         108748-706-765-689-373-0.6-0.7-0.6-0.3
142004M01January1307691813155781890.10.20.40.1107266-2188-2247-2171247-2.0-2.1-2.00.2
152004M02February130825563516763810.00.30.50.3107474208-2095-20604210.2-1.9-1.90.4
162004M03March1311423175548889100.20.40.70.7108369895-1085-8949120.8-1.0-0.80.8
172004M04April13141126964295712340.20.50.70.910946810992202-4513361.02.10.01.2
182004M05May131694283869122014980.20.70.91.2110392924291882314860.82.70.81.4
192004M06June13179399651120515990.10.50.91.21112818892912182716460.82.71.71.5
202004M07July13184855437107916570.00.30.81.3111231-501763396517940.01.63.71.6
212004M08August13193789243111217880.10.20.81.41112321840375816980.00.83.51.6
222004M09September13209315630095118390.10.20.71.4110903-329-37825341640-0.3-0.32.31.5
232004M10October132447354599103619930.30.50.81.5111357454126188918440.40.11.71.7
242004M11November1325035656680920290.00.40.61.6111458101226106618890.10.21.01.7
252004M12December13262412153183120360.10.40.61.6111350-108447691896-0.10.40.11.7
262004M13Annual         110148-1202-1209-10831400-1.1-1.1-1.01.3


The following code prints the catalog information:

libname blscat "%sysget(BLS)";

data myCAT;
   set blscat.blsex05_catalog;
run;

proc print data=myCAT; run;

Output 20.5.2: Catalog for Series CES0000000001 and CEU0500000001

Retrieve Current Employment Statistics Data

Obsordinal_seriesordinal_catalogseries_titleseries_idseasonalitysurvey_namesurvey_abbreviationmeasure_data_typecommerce_industrycommerce_sector
111All employees, thousands, total nonfarm, seasonally adjustedCES0000000001Seasonally AdjustedEmployment, Hours, and Earnings from the Current Employment Statistics survey (National)CEALL EMPLOYEES, THOUSANDSTotal nonfarmTotal nonfarm
222All employees, thousands, total private, not seasonally adjustedCEU0500000001Not Seasonally AdjustedEmployment, Hours, and Earnings from the Current Employment Statistics survey (National)CEALL EMPLOYEES, THOUSANDSTotal privateTotal private


Last updated: September 15, 2022