SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Junyong
Pyrite | Level 9

Suppose there is a data set with multiple URLs of raw data. Can one feed these paths as FILEVAR in INFILE to read multiple files? Or if impossible can one read multiple URLs using a FILENAME statement as follows?

filename pages url ('https://www.aqr.com/Insights/Datasets?&page=1' 'https://www.aqr.com/Insights/Datasets?&page=2');

It seems FILENAME does not allow this approach, but I wonder if there is any leeway to avoid %MACRO. Thanks for help.

1 ACCEPTED SOLUTION

Accepted Solutions
AhmedAl_Attar
Ammonite | Level 13

Try this

data _null_;
infile datalines ;
length fil2read $70;
input fil2read $;
infile dummy URL filevar=fil2read end=done;
do while(not done);
 input ;
 put _infile_;
end;
datalines;
https://www.aqr.com/Insights/Datasets?&page=1 
https://www.aqr.com/Insights/Datasets?&page=2
run;

Thanks,

Ahmed

View solution in original post

2 REPLIES 2
AhmedAl_Attar
Ammonite | Level 13

Try this

data _null_;
infile datalines ;
length fil2read $70;
input fil2read $;
infile dummy URL filevar=fil2read end=done;
do while(not done);
 input ;
 put _infile_;
end;
datalines;
https://www.aqr.com/Insights/Datasets?&page=1 
https://www.aqr.com/Insights/Datasets?&page=2
run;

Thanks,

Ahmed

Peter_C
Rhodochrosite | Level 12
Have a look at uses of the infile / file option DEVICE=

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

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
  • 2 replies
  • 628 views
  • 0 likes
  • 3 in conversation