SASEUSCB Interface Engine

Example 25.2 Retrieving Business Formation Statistics (BFS) Data for Business Applications (BA_BA) Data Type

This example shows how to retrieve Business Formation Statistics (BFS) data from the US Census Bureau website. You can view these data at the following web page:

https://www.census.gov/econ/currentdata/dbsearch?program=BFS&startYear=2004&endYear=2022&categories=TOTAL&dataType=BA_BA&geoLevel=US&adjusted=1&notAdjusted=1&errorData=0

The following SASEUSCB LIBNAME statement specifies the libref (USCB), followed by the engine name (SASEUSCB) and the physical path where the retrieved USCB data are to be stored. The SETNAME= option specifies the name of the data set to retrieve data from. In this example, SETNAME=EITS_BFS requests data from the Business Formation Statistics data set. The USER= option specifies your unique USCB API key. Without a user API key (which you can obtain free of charge), you cannot retrieve data from the US Census Bureau. The FOR='US:*' option requests data for all the US states, and the GEO='*' option specifies all geographic levels. The DATATYPE=BA_BA option specifies the business applications data type. If you want to include all data types, omit this option. See Table 10 for available data types to use when you specify the DATATYPE= option for the BFS data set. See Table 9 for a complete list of available categories. The OUTJSON= BFSTX option names the file where the JSON data are stored. The output data set is created by using the name that is specified in the OUTJSON= option and placed in the folder that is specified in the SASEUSCB LIBNAME statement. The date range of the data starts with September 2007, as specified by the STARTDATE='2007-09' option. The ENDDATE='2008-04' option specifies the last month to include in the range of data to retrieve (April 2008). The FORMAT=JSON option specifies that the data are to be retrieved in the JSON format. Output 25.2.1 shows the BFS data that are retrieved. Time series whose names end in '_S' contain seasonal data, and time series whose names end in '_U' contain nonseasonal data.


options validvarname=any;

title 'Retrieve Business Formation Statistics for Business Applications,
       DATATYPE=BA_BA';
libname uscb saseuscb "%sysget(USCB)"
   user='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   setname=EITS_BFS
   for='US:*'
   geo='*'
   datatype=BA_BA
   startdate='2007-09'
   enddate='2008-04'
   outjson=uscbex02
   format=json;

data myBFS;
   set uscb.uscbex02 ;
run;
proc contents data=myBFS; run;
proc print data=myBFS; run;

Output 25.2.1: Retrieve Business Formation Statistics (BFS) Economic Indicator Time Series Data for Business Applications

Retrieve Business Formation Statistics for Business Applications, DATATYPE=BA_BA

ObsdateNAICS11_BA_BA_S.USNAICS21_BA_BA_S.USNAICS22_BA_BA_S.USNAICS23_BA_BA_S.USNAICS42_BA_BA_S.USNAICS51_BA_BA_S.USNAICS52_BA_BA_S.USNAICS53_BA_BA_S.USNAICS54_BA_BA_S.USNAICS55_BA_BA_S.USNAICS56_BA_BA_S.USNAICS61_BA_BA_S.USNAICS62_BA_BA_S.USNAICS71_BA_BA_S.USNAICS72_BA_BA_S.USNAICS81_BA_BA_S.USNAICSMNF_BA_BA_S.USNAICSRET_BA_BA_S.USNAICSTW_BA_BA_S.USNONAICS_BA_BA_S.USTOTAL_BA_BA_S.USNAICS11_BA_BA_U.USNAICS21_BA_BA_U.USNAICS22_BA_BA_U.USNAICS23_BA_BA_U.USNAICS42_BA_BA_U.USNAICS51_BA_BA_U.USNAICS52_BA_BA_U.USNAICS53_BA_BA_U.USNAICS54_BA_BA_U.USNAICS55_BA_BA_U.USNAICS56_BA_BA_U.USNAICS61_BA_BA_U.USNAICS62_BA_BA_U.USNAICS71_BA_BA_U.USNAICS72_BA_BA_U.USNAICS81_BA_BA_U.USNAICSMNF_BA_BA_U.USNAICSRET_BA_BA_U.USNAICSTW_BA_BA_U.USNONAICS_BA_BA_U.USTOTAL_BA_BA_U.US
12007-0927697531972683081654791127691751629773151416351332214322761311872197185182277281228125972260611949644181223987230420810918143922541012551355330271229270031038316882451324880112262046194390
22007-1028208172202846088695087135351482531011138916965351314569808412517201895427304891167421702326301988698202240188100442812092126012693811421450630791283869741129617365480227780104051371202623
32007-1126577311542528584184580124921263528677117716185339113775734711764187234957276381085320472134842228826176254988865483513795133083061212681604434601455874411277119169521229976110671588222697
42007-123216776181291219083536914009137763434214701815438071622881311367521606559431600127842634245556260572217021092746139891326712038271181428128492841129646096104101573446012332795581673189943
52008-01269468414025584829246861251111551276691267150663349137197082116421756449272770510641207420884832236511292162670683900112021071927794104613193272613361593595981562244132280599841068186063
62008-02262875219324923841146071196811714282691205156983213141707467117661833150052744210680202121046345599352223401810808603815196150593874314652139441892006599131462225125660535528137691940280193
72008-0327137972482596087794958127941208129824123216166347414696793712434190275381287161117019422203283662855227290129296536213148127153161713701829136331510988501283921021572430933118841837237385
82008-0427877712402539390274934125931170729931124216114358814875784512363194465029286251069819522191593183775220274118973512012390119032976412481781436931440881981264820179513329580111792346226165


You can subset your results by adding a KEEP= or DROP= option to your DATA statement as follows:

data myBFS( keep= date TOTAL:);
   set uscb.uscbex02 ;
run;

The results from the KEEP= option in the DATA statement return two time series, 'TOTAL_BA_BA_S.US'n and 'TOTAL_BA_BA_U.US'n, along with the date of each observation. Each time series is named by concatenating the category code, the data type code, and the seasonality code, using the underscore as the concatenation character, followed by the suffix '.US' (for United States).

Last updated: July 09, 2026