I am using base sas on windows platform, I have 2 .csv files that I need to read from the url and save them to my desktop using API token.. CSV file has headers..
In the code below, I am trying to read one .csv file. Is there a specific order to pass these parameters?
%let mytoken =yyyyyyy;
filename my_in1 "ebyyc88ret54"; *.csv dataset name in that url;
proc http
url = "https://yyyy.yy/proxy/api/dataproxy/datasets/"
in= my_in1
out= my_out
method="GET"
headerin=headers
oauth_bearer = &mytoken.;
run;
I am getting the following error ( Iguess the system is checking for the my_in1 on my c drive instead of the URL..
ERROR: Physical file does not exist,
C:\temp\ebyyc88ret54.
Thank you
It worked with little changes..
filename dsn_out1 "c:\temp\Test.csv"; *output file path & name;
%let mytoken =xxxxxxxxxxxxxx; *API token;
proc http out=dsn_out1 verbose method="GET"
URL="https://NIH.org/dataproxy/datasets/&dsn_in./includeColumnNames=true";
Headers
"Authorization" = "Bearer &mytoken.";
run;
I'm not sure that you need to use "IN". But my experience is limited with this.
filename my_out "ebyyc88ret54"; *.csv dataset name in that url;
options validmemname=extend;
proc http
url = "https://www.w3schools.com/python/pandas/data.csv"
out= my_out
method="GET"
headerin=headers
;
run;
data "a look into"n;
infile my_out obs=5;
input;
infile=_Infile_;
run;
It worked with little changes..
filename dsn_out1 "c:\temp\Test.csv"; *output file path & name;
%let mytoken =xxxxxxxxxxxxxx; *API token;
proc http out=dsn_out1 verbose method="GET"
URL="https://NIH.org/dataproxy/datasets/&dsn_in./includeColumnNames=true";
Headers
"Authorization" = "Bearer &mytoken.";
run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.