BookmarkSubscribeRSS Feed
mlogan
Lapis Lazuli | Level 10

Hi All,

I want to create a folder ('07 - 2018 JUL' which is dynamic based on the previous month) and a sub folder ('Personal') at the same time under the location 'C:\Temp\2018 - 2019'. I figured out the folder part, but don't know how to create a sub folder. Can any one help please. Thanks.

My ultimate folder hierarchy will be  'C:\Temp\2018 - 2019\07 - 2018 JUL\Personal'

 


DATA _NULL_; rootdir='C:\Temp\2018 - 2019'; today=today(); lastmonth=intnx('month',today,-1); dir1=catx(' ',put(month(lastmonth),z2.),'-',year(lastmonth),UPCASE(put(lastmonth,monname3.))); newdir1=dcreate(dir1,rootdir); RUN;

 

 

 

 

2 REPLIES 2
Reeza
Super User

Call DCREATE again with the PERSONAL name?

ChrisNZ
Tourmaline | Level 20

Function dcreate() creates all parent directories when you create the bottom one.

 

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
  • 2 replies
  • 820 views
  • 2 likes
  • 3 in conversation