Can anyone help in creating a macro

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Can anyone help in creating a macro

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.

Accepted Solutions
Solution
‎11-21-2016 01:19 PM
Grand Advisor
Posts: 17,360

Re: Can anyone help in creating a macro

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


All Replies
Solution
‎11-21-2016 01:19 PM
Grand Advisor
Posts: 17,360

Re: Can anyone help in creating a macro

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

 

 

New Contributor
Posts: 4

Re: Can anyone help in creating a macro

Thanks for the solution provided Reeza. Can you help in writing the code and explain .
Grand Advisor
Posts: 17,360

Re: Can anyone help in creating a macro

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. 

 

 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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