Hey folks,
I have a S3 bucket that contains multiple csv files named with certain prefix and suffix, something like blabla_yymmdd.csv
I am wondering if we can get all the file names using proc s3 or any other alternatives?
Thanks in advance!
You can use the LIST statement to get a list of the files with a particular prefix.
But unless they have updated PROC S3 in the last few years the only way I found to capture that into data was to redirect the SAS LOG to a file and read it back in.
filename list temp;
options nonotes nosource;
proc printto log=list new; run;
proc s3 config="&config";
list "/&bucket/team_rwa/sas_download";
run;
proc printto log=log; run;
options notes source;
Then you can run a data step to read the new LIST file and parse out the filename size and datetime stamp.
You can use the LIST statement to get a list of the files with a particular prefix.
But unless they have updated PROC S3 in the last few years the only way I found to capture that into data was to redirect the SAS LOG to a file and read it back in.
filename list temp;
options nonotes nosource;
proc printto log=list new; run;
proc s3 config="&config";
list "/&bucket/team_rwa/sas_download";
run;
proc printto log=log; run;
options notes source;
Then you can run a data step to read the new LIST file and parse out the filename size and datetime stamp.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.