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

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!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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.

 

View solution in original post

1 REPLY 1
Tom
Super User Tom
Super User

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.

 

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
  • 1 reply
  • 1845 views
  • 0 likes
  • 2 in conversation