Department of Labor Logo United States Department of Labor
Dot gov

The .gov means it's official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you're on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Developer's Site
PRINT:Print

Accessing the Public Data API with SAS Procedures:

On This Page:

You can access the Public Data API through SAS Procedures using the following code. We have provided examples for each API Signature.

API Version 2.0 SAS Sample Code

One or More Series

Use this signature to retrieve data for more than one timeseries for the past three years. You can include up to 25 series IDs.

Sample SeriesIn.txt

   
{"seriesid":["CEU0800000003","CFU0000008000","LEU0254555900","APU0000701111"]}

 

Sample SAS Code:

  
%let url=https://api.bls.gov/publicAPI/v2/timeseries/data/;
filename in  "c:\somepath\SeriesIn.txt";
filename out "c:\somepath\SeriesDataOut.txt" recfm=v lrecl=32000;
proc http in=in out=out url="&url" method="post" ct="application/json";
run;


 

One or More Series, Specifying Years

Use this signature to retrieve data for one or more time series within a set time frame of up to 10 years. You must include at least one series ID, the start year, and the end year in the body of the request.

Sample SeriesIn.txt

   
{"seriesid":["CEU0800000003","CFU0000008000","LEU0254555900","APU0000701111"],
"startyear":"2002",
"endyear":"2012"}

 

Sample SAS Code:

  
%let url=https://api.bls.gov/publicAPI/v2/timeseries/data/;
filename in  "c:\somepath\SeriesIn.txt";
filename out "c:\somepath\SeriesDataOut.txt" recfm=v lrecl=32000;
proc http in=in out=out url="&url" method="post" ct="application/json";
run;


API Version 1.0 SAS Sample Code

One or More Series

Use this signature to retrieve data for more than one timeseries for the past three years. You can include up to 25 series IDs.

Sample SeriesIn.txt

   
{"seriesid":["CEU0800000003","CFU0000008000","LEU0254555900","APU0000701111"]}

 

Sample SAS Code:

  
%let url=https://api.bls.gov/publicAPI/v1/timeseries/data/;
filename in  "c:\somepath\SeriesIn.txt";
filename out "c:\somepath\SeriesDataOut.txt" recfm=v lrecl=32000;
proc http in=in out=out url="&url" method="post" ct="application/json";
run;


 

One or More Series, Specifying Years

Use this signature to retrieve data for one or more time series within a set time frame of up to 10 years. You must include at least one series ID, the start year, and the end year in the body of the request.

Sample SeriesIn.txt

   
{"seriesid":["CEU0800000003","CFU0000008000","LEU0254555900","APU0000701111"],
"startyear":"2002",
"endyear":"2012"}

 

Sample SAS Code:

  
%let url=https://api.bls.gov/publicAPI/v1/timeseries/data/;
filename in  "c:\somepath\SeriesIn.txt";
filename out "c:\somepath\SeriesDataOut.txt" recfm=v lrecl=32000;
proc http in=in out=out url="&url" method="post" ct="application/json";
run;


 

 

Acknowledgments:

The BLS API Team thanks Mr. Jim Hoffman for contributing the above sample SAS code.

 

Last Modified Date: October 16, 2014