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. 

 

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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
  • 1227 views
  • 0 likes
  • 2 in conversation