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.

 

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