BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Stalk
Pyrite | Level 9

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

1 ACCEPTED SOLUTION

Accepted Solutions
Stalk
Pyrite | Level 9

 

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;

 

View solution in original post

3 REPLIES 3
PhilC
Rhodochrosite | Level 12

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;
Stalk
Pyrite | Level 9
Where should I give the token. That is mandatory.
Stalk
Pyrite | Level 9

 

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;

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1408 views
  • 1 like
  • 2 in conversation