SASEBEA Interface Engine

Getting Started: SASEBEA Interface Engine

As described in the preceding section, you need a user ID key to use the BEA economic statistics data web service.

The web page at the following URL describes how to use the BEA’s Data Retrieval API:

https://apps.bea.gov/api/_pdf/bea_web_service_api_user_guide.pdf

The statements at the end of this section enable you to access the BEA National Income and Product Accounts (NIPA) Table T10101, which is described as "Table 1.1.1. Percent Change from Preceding Period in Real Gross Domestic Product [Percent] Seasonally Adjusted at Annual Rates."

The TABLENAME= option specifies which table you want to retrieve the data from in the data set that you specify in the SETNAME= option, which in this sample code is the T10101 table in the NIPA data set.

The OUT= option specifies both the name of the resulting JSON file(s) and the name of the SAS data set.

The range of the retrieved data is determined by the YEAR= option. You specify each year in a quoted list in 'YYYY' format.

The JSON data that the BEA’s website returns are placed in a file that is named by the OUT= option—in this case, NIPGDP.json. Note: The SASEBEA interface engine appends a numeral to the JSON file name, and the file extension (.json) is excluded from the file name that appears in the OUT= option (or OUTJSON= option). When the SET statement is executed, the JSON data are read (and merged) into a SAS data set named NIPGDP.sas7bdat, which resides in the location that is specified inside the string enclosed in double quotation marks in the LIBNAME statement.

The result is named in the DATA step in the SET statement and is shown in Figure 1. Note: It is good practice to use the DATA step with the SET statement, followed by a separate proc print statement that references the output data set named in the DATA step. For more information, see SAS Output Data Set.

For another example that uses more LIBNAME statement options, see the section Examples: SASEBEA Interface Engine.

options validvarname=any;

title 'Retrieve Gross Domestic Product Data for United States, Table T10101';
libname mylib "physical path to the folder where you want the BEA NIPA data";

title1 "National Income and Product Accounts Data";
title2 "Request Table 10101";
libname beanipa sasebea "physical path to the folder where you want the BEA NIPA data"
   setname=NIPA
   TableName="T10101"
   user='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'  /* access key */ 
   freq=Q                 /* quarterly data */
   outjson=NIPGDP
   year='2014,2015,2016,2017'
   ;

data mylib.myGDP;
   set beanipa.NIPGDP;    /* NIPGDP is specified in the OUT= option */
run;
title3 "The mylib.myGDP Data Set";
proc print data=mylib.myGDP; run;

Figure 1: US Gross Domestic Product in Table T10101

National Income and Product Accounts Data
Request Table 10101
The mylib.myGDP Data Set

ObsTableNameDateA006RLA007RLA008RLA009RLA011RLA020RLA021RLA191RLA191RPA253RLA255RLA646RLA656RLA822RLA823RLA824RLA825RLA829RLDDURRLDGDSRLDNDGRLDPCERLDSERRLY001RLY033RL
1T101012014Q1-4.44.15.714.8-2.8-3.85.3-1.40.3-6.85.03.06.4-1.6-0.4-4.97.3-2.46.52.70.91.51.02.53.5
2T101012014Q218.011.611.214.913.48.99.45.27.610.911.74.8-0.80.5-2.3-2.5-2.12.315.27.43.93.82.19.510.4
3T101012014Q38.47.98.31.36.01.60.84.76.64.01.0-3.2-0.32.74.65.23.61.67.54.73.44.03.77.412.8
4T101012014Q40.44.72.56.715.03.310.91.82.53.410.63.312.7-0.2-5.7-10.62.53.47.85.54.44.54.18.6-3.5
5T101012015Q114.71.1-0.5-4.28.1-3.25.93.33.1-7.58.96.2-6.92.11.7-1.05.92.47.44.93.72.71.7-2.93.3
6T101012015Q21.23.51.83.010.41.13.02.34.62.82.8-2.23.83.50.70.31.35.28.74.32.22.72.01.41.5
7T101012015Q3-0.83.41.5-12.011.2-3.33.51.32.5-4.12.9-1.86.11.8-0.4-3.84.83.25.54.64.13.12.45.56.5
8T101012015Q4-4.7-1.1-3.2-15.17.2-0.60.80.60.5-2.2-1.22.610.21.43.03.22.80.52.31.61.22.02.29.7-5.0
9T101012016Q1-1.72.4-0.4-13.812.9-1.2-0.62.42.02.0-0.2-6.8-2.24.31.0-0.43.16.35.34.13.53.02.512.9-2.1
10T101012016Q2-2.12.22.68.00.53.10.41.24.10.00.39.00.9-0.6-3.2-5.90.81.04.03.53.32.01.410.0-4.9
11T101012016Q30.83.75.316.9-2.06.42.92.43.67.42.14.46.72.12.54.8-0.81.810.44.00.92.41.67.6-1.8
12T101012016Q410.63.12.66.05.1-2.86.12.04.20.38.5-8.3-3.90.80.3-0.41.31.25.72.20.42.01.93.40.3
13T101012017Q1-1.26.45.27.210.89.95.91.94.08.44.612.711.7-0.8-2.8-3.7-1.50.32.83.53.82.92.77.32.4
14T101012017Q27.23.84.20.22.61.64.32.33.6-0.13.54.87.91.23.48.6-3.7-0.14.44.34.31.90.81.78.5
15T101012017Q36.20.51.2-10.6-1.92.7-0.12.95.02.0-1.03.93.7-0.3-0.1-1.11.3-0.49.74.41.82.31.37.63.1
16T101012017Q44.78.18.44.37.09.710.73.86.814.415.61.5-8.12.84.95.44.11.715.38.24.84.32.56.712.0


Last updated: July 09, 2026