SASEBLS Interface Engine

Example 23.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 IDs of the time series to be retrieved 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 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, 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. The FORMAT= option specifies that the data are to be retrieved using the JSON format. Output 23.5.1 shows the data that are retrieved. Output 23.5.2 shows the catalog information for the retrieved data.


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
   CATALOG=true
   FORMAT=json;

data myCES;
   set bls.blsex05 ;
run;

proc print data=myCES; run;

Output 23.5.1: All Seasonally Adjusted Nonfarm 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
12003M01January130579109-42-4-2730.10.00.0-0.2107019-2266-2633-2870-558-2.1-2.4-2.6-0.5
22003M02February130443-136-175-144-289-0.1-0.1-0.1-0.210705233-2583-2893-5840.0-2.4-2.6-0.5
32003M03March130233-210-237-265-488-0.2-0.2-0.2-0.4107457405-1828-2037-6620.4-1.7-1.9-0.6
42003M04April130176-57-403-445-4410.0-0.3-0.3-0.31081316741112-1521-5660.61.0-1.4-0.5
52003M05May13019721-246-421-4360.0-0.2-0.3-0.31089067751854-729-4610.71.7-0.7-0.4
62003M06June130192-5-41-278-4910.00.0-0.2-0.41096347282177349-5190.72.00.3-0.5
72003M07July130183-97-396-4000.00.0-0.3-0.3109438-19613072419-451-0.21.22.3-0.4
82003M08August130153-30-44-290-4340.00.0-0.2-0.3109533956272481-4120.10.62.3-0.4
92003M09September130252996019-2460.10.00.0-0.2109262-271-3721805-232-0.2-0.31.7-0.2
102003M10October130439187256263-1820.10.20.2-0.1109512250741381-1400.20.11.3-0.1
112003M11November13048243329285-1360.00.30.2-0.11095695736663-660.10.00.6-0.1
122003M12December1305951133434031250.10.30.30.1109454-115192-180169-0.10.2-0.20.2
132004M01January1307651703265821860.10.20.40.1107266-2188-2246-2172247-2.0-2.1-2.00.2
142004M02February130822573406693790.00.30.50.3107474208-2095-20594220.2-1.9-1.90.4
152004M03March1311393175448879060.20.40.70.7108369895-1085-8939120.8-1.0-0.80.8
162004M04April13141027164597112340.20.50.70.910946810992202-4413371.02.10.01.2
172004M05May131694284872121214970.20.70.91.1110392924291882314860.82.70.81.4
182004M06June13178995650119415970.10.50.91.21112808882911182616460.82.71.71.5
192004M07July13184960439108416660.00.30.81.3111231-491763396517930.01.63.71.6
202004M08August13193687242111417830.10.20.91.41112321840375816990.00.83.51.6
212004M09September13208214629394318300.10.20.71.4110901-331-37925321639-0.3-0.32.31.5
222004M10October132433351584102319940.30.40.81.5111357456126188918450.40.11.71.7
232004M11November1325097657381520270.10.40.61.6111457100225106518880.10.21.01.7
242004M12December13263312455184420380.10.40.61.6111349-108448691895-0.10.40.11.7


The following statements print the catalog information shown in Output 23.5.2:

libname blscat "%sysget(BLS)";

data myCAT;
   set blscat.blsex05_catalog;
run;

proc print data=myCAT; run;

Output 23.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: July 09, 2026