SASEBLS Interface Engine

Example 23.2 Retrieving Producer Price Index (PPI) Data for Multiple Time Series

This example shows how to use multiple time series IDs to retrieve Producer Price Index Revision–Current (PC) series data and Producer Price Index–Current Commodity (WP) series data. You can view these data at the following URL:

https://www.bls.gov/ppi/data.htm

INSERIES is an input SAS data set that lists the IDs of the time series to be retrieved from the Producer Price Index (PPI) 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 17 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 for the list of series to retrieve using their IDs. The date range of the data starts with 1985, as specified by the STARTYEAR= option. The ENDYEAR= option specifies the last year to include in the range of data to retrieve. FREQ=M13 specifies the selection of only the annual averaged monthly data, and the FORMAT= option specifies that the data are to be retrieved using the JSON format. Output 23.2.1 shows the PPI data that are retrieved.


options validvarname=any;

DATA inseries;
   length seriesid $ 17;
   seriesid = 'WPU013'; output; /* Commodity data for farm livestock, has M13*/
   seriesid = 'WPU014'; output; /* Commodity data for farm poultry, has M13  */
   seriesid = 'PCU212221212221'; output;  /* PPI, Gold Ore Mining, has M13  */
   seriesid = 'PCU212312212312S'; output; /* PPI, Limestone Mining, has M13 */
RUN;

title 'Retrieve Producer Price Index Data for Multiple Time Series';
libname bls sasebls "%sysget(BLS)"
   USER='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   SETNAME=PPI
   INSET=inseries
   PAYPATH= "%sysget(BLS)payload"
   OUTJSON=blsex02
   STARTYEAR='1985'
   ENDYEAR='1994'
   FREQ=M13
   FORMAT=json;

data myPPI;
   set bls.blsex02 ;
run;
proc contents data=myPPI; run;
proc print data=myPPI; run;

Output 23.2.1: Retrieve Producer Price Index Annual Average Monthly Data for Multiple Time Series

Retrieve Producer Price Index Data for Multiple Time Series

ObsyearperiodperiodNamePCU212312212312SWPU013WPU014
11985M13Annual100.489.2117.9
21986M13Annual100.791.8129.7
31987M13Annual101.1102.0101.2
41988M13Annual101.8103.3121.5
51989M13Annual102.0106.1128.8
61990M13Annual102.8115.6118.8
71991M13Annual106.1107.9111.2
81992M13Annual103.5104.7112.6
91993M13Annual105.4107.0122.0
101994M13Annual108.196.4124.4


Last updated: July 09, 2026