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.
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →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.