BookmarkSubscribeRSS Feed
Walternate
Obsidian | Level 7

Hi,

 

I need to create a lot of subfolders in a directory. They will always be the final folder in a branch of the directory and always have the same name, eg:

 

Folder1/Folder2/test

Folder1/Folder3/test

Folder1/Folder4/Folder5/test

 

I was thinking there must be a way to automate this in SAS. I would know how to set it up by hand or even providing the beginning of the path and just automating the addition of test, but I was thinking there is probably a way that I can do it using just the umbrella folder (Folder1) and let SAS figure out the rest. Am I correct in thinking this? What is the best way to set this up so it's as automated as possible?

 

 

1 REPLY 1
Reeza
Super User

Have you seen this post?

It doesn't do the nested loops but I'm 99% certain there's code for that on here already. 

 

https://blogs.sas.com/content/sasdummy/2013/07/02/use-dlcreatedir-to-create-folders/

 


@Walternate wrote:

Hi,

 

I need to create a lot of subfolders in a directory. They will always be the final folder in a branch of the directory and always have the same name, eg:

 

Folder1/Folder2/test

Folder1/Folder3/test

Folder1/Folder4/Folder5/test

 

I was thinking there must be a way to automate this in SAS. I would know how to set it up by hand or even providing the beginning of the path and just automating the addition of test, but I was thinking there is probably a way that I can do it using just the umbrella folder (Folder1) and let SAS figure out the rest. Am I correct in thinking this? What is the best way to set this up so it's as automated as possible?

 

 


 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 612 views
  • 0 likes
  • 2 in conversation