I suggest to use Proc HTTP with the QUERY option to download what you need. See the code below for an example. Using the query option it is quite easy to provide name=value pairs in the url.
%let time = 2021-11;
%let cty_code = 1220;
%let I_commodity = 12*;
filename resp temp;
proc http
method="get"
url='https://api.census.gov/data/timeseries/intltrade/imports/hs'
query=(
"get" = "YEAR,MONTH,RP,CTY_CODE,CTY_SUBCODE,DISTRICT,DIST_NAME,CON_QY1_MO,CON_QY1_YR,I_COMMODITY,I_COMMODITY_SDESC,I_COMMODITY_LDESC,CON_VAL_MO,CON_VAL_YR,CON_CHA_MO,CON_CHA_YR,GEN_VAL_MO,CAL_DUT_MO,CAL_DUT_YR"
"SUMMARY_LVL2" = "HSCYCSDTRP"
"COMM_LVL" = "HS10"
"time"="&time"
"CTY_CODE" = "&CTY_CODE"
"I_COMMODITY" = "&I_COMMODITY"
)
verbose
out=resp
;
run;
libname resp json;
proc copy in=resp out=work;
run;
libname resp clear;
filename resp clear;
... View more