SASEBLS Interface Engine

Example 23.7 Retrieving Labor Force Current Population Statistics (CPS) Data

This example shows how to retrieve data from the Weekly Hours and Earnings Survey, LE, and the Labor Force Statistics Survey (includes the national unemployment rate), LN, both from the Current Population Statistics program data. You can view these data by using the following URL:

https://www.bls.gov/cps/

INSERIES is an input SAS data set that lists the IDs of the time series to be retrieved from the Current Population 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 2021, as specified by the STARTYEAR= option. The ENDYEAR= option specifies the last year, 2022, to include in the range of data to retrieve. The FREQ=QUARTERLY option specifies the selection of quarterly 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.7.1 shows the data that are retrieved. Output 23.7.2 shows the catalog information for the retrieved data.


options validvarname=any;
libname blscat "%sysget(BLS)";     /* for Catalog data set*/

DATA inseries;
   length seriesid $ 32;
   seriesid = 'LNS11000000Q'; output;
   seriesid = 'LNS11000012Q'; output;
   seriesid = 'LES1252881500'; output;
   seriesid = 'LES1252882800'; output;
RUN;

title 'Retrieve Labor Force Current Population Statistics Data';
libname bls sasebls "%sysget(BLS)"
   USER='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   SETNAME=CPS
   INSET=inseries
   PAYPATH= "%sysget(BLS)payload"
   OUTJSON=blsex07
   STARTYEAR='2021'
   ENDYEAR='2022'
   FREQ=Quarterly
   CALCULATIONS=true
   CATALOG=true
   FORMAT=json;

data myCPS;
   set bls.blsex07 ;
run;
proc contents data=myCPS; run;
proc print data=myCPS; run;

Output 23.7.1: Weekly Earnings and Civilian Labor Force Level: Current Population Statistics

Retrieve Labor Force Current Population Statistics Data

ObsyearperiodperiodNameLES1252881500LES1252881500_3LES1252881500_6LES1252881500_12LES1252881500%3LES1252881500%6LES1252881500%12LES1252882800LES1252882800_3LES1252882800_6LES1252882800_12LES1252882800%3LES1252882800%6LES1252882800%12LNS11000000QLNS11000000Q_3LNS11000000Q_6LNS11000000Q_12LNS11000000Q%3LNS11000000Q%6LNS11000000Q%12LNS11000012QLNS11000012Q_3LNS11000012Q_6LNS11000012Q_12LNS11000012Q%3LNS11000012Q%6LNS11000012Q%12
12021Q011st Quarter9830-11320.0-1.13.4340-2-710-0.6-2.03.0160225-571-124-3588-0.4-0.1-2.25938-12268-77-0.24.7-1.3
22021Q022nd Quarter9961313-121.31.3-1.2337-3-5-22-0.9-1.5-6.116094772215128550.50.11.8599355436660.90.712.5
32021Q033rd Quarter100151870.51.80.7335-2-5-12-0.6-1.5-3.5161521574129611720.40.80.75949-4411279-0.70.24.9
42021Q044th Quarter1010914270.91.42.7333-2-4-9-0.6-1.2-2.6162155634120813590.40.80.8597425-19240.4-0.30.4
52022Q011st Quarter10322231492.23.15.0329-4-6-11-1.2-1.8-3.21639321777241137071.11.52.362152412662774.04.54.7
62022Q022nd Quarter10481638521.63.85.2326-3-7-11-0.9-2.1-3.3164077145192231300.11.21.96243282692500.54.54.2
72022Q033rd Quarter10702238692.13.76.93271-2-80.3-0.6-2.416444136450929200.20.31.8628037653310.61.05.6
82022Q044th Quarter10841436741.33.47.332701-60.00.3-1.816471327263625580.20.41.66367871243931.42.06.6


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

libname blscat "%sysget(BLS)";     /* for Catalog data set*/

data myCAT;
   set blscat.blsex07_catalog;
run;
proc print data=blscat.blsex07_catalog; run;

Output 23.7.2: Catalog for Weekly Earnings and Civilian Labor Force Level: Current Population Statistics

Retrieve Labor Force Current Population Statistics Data

Obsordinal_seriesordinal_catalogseries_titleseries_idseasonalitysurvey_namesurvey_abbreviationmeasure_data_typecommerce_industryoccupationoccupation_work_classcps_labor_force_statusdemographic_agedemographic_ethnic_origindemographic_racedemographic_genderdemographic_education
111(Seas)- Median usual weekly earnings (second quartile), Employed full time, Wage and salary workersLES1252881500Seasonally AdjustedWeekly and hourly earnings data from the Current Population SurveyLEMedian usual weekly earnings - in current dollars (second quartile)All IndustriesAll OccupationsWage and salary workers, excluding incorporated self employedEmployed full time16 years and overAll OriginsAll RacesBoth SexesAll educational levels
222(Seas)- Constant (1982-84) dollar adjusted to CPI-U- Median usual weekly earnings, Employed full time, Wage and salary workers, WomenLES1252882800Seasonally AdjustedWeekly and hourly earnings data from the Current Population SurveyLEMedian usual weekly earnings - in constant (1982-84) dollarsAll IndustriesAll OccupationsWage and salary workers, excluding incorporated self employedEmployed full time16 years and overAll OriginsAll RacesWomenAll educational levels
333(Seas) Civilian Labor Force LevelLNS11000000QSeasonally AdjustedLabor Force Statistics from the Current Population SurveyLNNumber in thousandsAll IndustriesAll Occupations Civilian labor force16 years and overAll OriginsAll RacesBoth SexesAll educational levels
444(Seas) Civilian Labor Force Level - 16-19 yrs.LNS11000012QSeasonally AdjustedLabor Force Statistics from the Current Population SurveyLNNumber in thousandsAll IndustriesAll Occupations Civilian labor force16 to 19 yearsAll OriginsAll RacesBoth SexesAll educational levels


Last updated: July 09, 2026