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;
Call DCREATE again with the PERSONAL name?
Function dcreate() creates all parent directories when you create the bottom one.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.