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:
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;
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 |
| Obs | date | NAICS11_BA_BA_S.US | NAICS21_BA_BA_S.US | NAICS22_BA_BA_S.US | NAICS23_BA_BA_S.US | NAICS42_BA_BA_S.US | NAICS51_BA_BA_S.US | NAICS52_BA_BA_S.US | NAICS53_BA_BA_S.US | NAICS54_BA_BA_S.US | NAICS55_BA_BA_S.US | NAICS56_BA_BA_S.US | NAICS61_BA_BA_S.US | NAICS62_BA_BA_S.US | NAICS71_BA_BA_S.US | NAICS72_BA_BA_S.US | NAICS81_BA_BA_S.US | NAICSMNF_BA_BA_S.US | NAICSRET_BA_BA_S.US | NAICSTW_BA_BA_S.US | NONAICS_BA_BA_S.US | TOTAL_BA_BA_S.US | NAICS11_BA_BA_U.US | NAICS21_BA_BA_U.US | NAICS22_BA_BA_U.US | NAICS23_BA_BA_U.US | NAICS42_BA_BA_U.US | NAICS51_BA_BA_U.US | NAICS52_BA_BA_U.US | NAICS53_BA_BA_U.US | NAICS54_BA_BA_U.US | NAICS55_BA_BA_U.US | NAICS56_BA_BA_U.US | NAICS61_BA_BA_U.US | NAICS62_BA_BA_U.US | NAICS71_BA_BA_U.US | NAICS72_BA_BA_U.US | NAICS81_BA_BA_U.US | NAICSMNF_BA_BA_U.US | NAICSRET_BA_BA_U.US | NAICSTW_BA_BA_U.US | NONAICS_BA_BA_U.US | TOTAL_BA_BA_U.US |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2007-09 | 2769 | 753 | 197 | 26830 | 8165 | 4791 | 12769 | 17516 | 29773 | 1514 | 16351 | 3322 | 14322 | 7613 | 11872 | 19718 | 5182 | 27728 | 12281 | 2597 | 226061 | 1949 | 644 | 181 | 22398 | 7230 | 4208 | 10918 | 14392 | 25410 | 1255 | 13553 | 3027 | 12292 | 7003 | 10383 | 16882 | 4513 | 24880 | 11226 | 2046 | 194390 |
| 2 | 2007-10 | 2820 | 817 | 220 | 28460 | 8869 | 5087 | 13535 | 14825 | 31011 | 1389 | 16965 | 3513 | 14569 | 8084 | 12517 | 20189 | 5427 | 30489 | 11674 | 2170 | 232630 | 1988 | 698 | 202 | 24018 | 8100 | 4428 | 12092 | 12601 | 26938 | 1142 | 14506 | 3079 | 12838 | 6974 | 11296 | 17365 | 4802 | 27780 | 10405 | 1371 | 202623 |
| 3 | 2007-11 | 2657 | 731 | 154 | 25285 | 8418 | 4580 | 12492 | 12635 | 28677 | 1177 | 16185 | 3391 | 13775 | 7347 | 11764 | 18723 | 4957 | 27638 | 10853 | 2047 | 213484 | 2228 | 826 | 176 | 25498 | 8865 | 4835 | 13795 | 13308 | 30612 | 1268 | 16044 | 3460 | 14558 | 7441 | 12771 | 19169 | 5212 | 29976 | 11067 | 1588 | 222697 |
| 4 | 2007-12 | 3216 | 776 | 181 | 29121 | 9083 | 5369 | 14009 | 13776 | 34342 | 1470 | 18154 | 3807 | 16228 | 8131 | 13675 | 21606 | 5594 | 31600 | 12784 | 2634 | 245556 | 2605 | 722 | 170 | 21092 | 7461 | 3989 | 13267 | 12038 | 27118 | 1428 | 12849 | 2841 | 12964 | 6096 | 10410 | 15734 | 4601 | 23327 | 9558 | 1673 | 189943 |
| 5 | 2008-01 | 2694 | 684 | 140 | 25584 | 8292 | 4686 | 12511 | 11551 | 27669 | 1267 | 15066 | 3349 | 13719 | 7082 | 11642 | 17564 | 4927 | 27705 | 10641 | 2074 | 208848 | 3223 | 651 | 129 | 21626 | 7068 | 3900 | 11202 | 10719 | 27794 | 1046 | 13193 | 2726 | 13361 | 5935 | 9598 | 15622 | 4413 | 22805 | 9984 | 1068 | 186063 |
| 6 | 2008-02 | 2628 | 752 | 193 | 24923 | 8411 | 4607 | 11968 | 11714 | 28269 | 1205 | 15698 | 3213 | 14170 | 7467 | 11766 | 18331 | 5005 | 27442 | 10680 | 2021 | 210463 | 4559 | 935 | 222 | 34018 | 10808 | 6038 | 15196 | 15059 | 38743 | 1465 | 21394 | 4189 | 20065 | 9913 | 14622 | 25125 | 6605 | 35528 | 13769 | 1940 | 280193 |
| 7 | 2008-03 | 2713 | 797 | 248 | 25960 | 8779 | 4958 | 12794 | 12081 | 29824 | 1232 | 16166 | 3474 | 14696 | 7937 | 12434 | 19027 | 5381 | 28716 | 11170 | 1942 | 220328 | 3662 | 855 | 227 | 29012 | 9296 | 5362 | 13148 | 12715 | 31617 | 1370 | 18291 | 3633 | 15109 | 8850 | 12839 | 21021 | 5724 | 30933 | 11884 | 1837 | 237385 |
| 8 | 2008-04 | 2787 | 771 | 240 | 25393 | 9027 | 4934 | 12593 | 11707 | 29931 | 1242 | 16114 | 3588 | 14875 | 7845 | 12363 | 19446 | 5029 | 28625 | 10698 | 1952 | 219159 | 3183 | 775 | 220 | 27411 | 8973 | 5120 | 12390 | 11903 | 29764 | 1248 | 17814 | 3693 | 14408 | 8198 | 12648 | 20179 | 5133 | 29580 | 11179 | 2346 | 226165 |
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).