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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 540 views
  • 0 likes
  • 2 in conversation