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;

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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