BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
anilsabs
Calcite | Level 5
In my folder there are multiple files,i just want to create a Sas dataset that contains only one variable which has the values excel file names,means it should fetch excel files names and store in one variable.
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

SAS 9.4 Macro documentation has a set of examples, Example 2 is how to list all files in a directory, including sub directory. So this is a bit more than you want but can be modified to give you what you want.

 

http://support.sas.com/documentation/cdl/en/mcrolref/67912/HTML/default/viewer.htm#n0js70lrkxo6uvn1f...

 

 

View solution in original post

3 REPLIES 3
Reeza
Super User

SAS 9.4 Macro documentation has a set of examples, Example 2 is how to list all files in a directory, including sub directory. So this is a bit more than you want but can be modified to give you what you want.

 

http://support.sas.com/documentation/cdl/en/mcrolref/67912/HTML/default/viewer.htm#n0js70lrkxo6uvn1f...

 

 

anilsabs
Calcite | Level 5
Thanks for the solution provided Reeza. Can you help in writing the code and explain .
Reeza
Super User

Please review the link and give it a shot first. It has full code AND walks through it section by section below in more detail that I would. 

 

If you have no sub-folders in your directory you can use it as is. 

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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