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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 756 views
  • 0 likes
  • 2 in conversation