I need help with the following. Im not a SAS guru. Im in the process of building automated SAS runs, the SAS code need to autoupdate the libname with the current month's date (however the day will ALWAYS be the 7th).
the libname should look like this this month:
libname mylib 'C:\Users\folder1\Folder2\2017-06-07'
next month:
libname mylib 'C:\Users\folder1\Folder2\2017-07-07'
the month after that
libname mylib 'C:\Users\folder1\Folder2\2017-08-07'
I struggle with this , please assist.
Then you should determine the date like that:
data _null_;
mydate = input(put(today(),yymmn6.) !! '07',yymmdd8.);
call symput('d',put(mydate,yymmddd10.));
run;
This should work:
data _null_; call symputx('D',put(intnx('month',today(),0,'b'),yymmdd10.)); run; libname mylib 'C:\Users\folder1\Folder2\&d.';
Just what @RW9 suggested, but with one little caveat:
libname mylib "C:\Users\folder1\Folder2\&d.";
Note the double quotes, single quotes would prevent the resolution of the macro variable.
Thank you for the quick responses, i still struggle with the hardcoding of the 7th day in the same question.
Then you should determine the date like that:
data _null_;
mydate = input(put(today(),yymmn6.) !! '07',yymmdd8.);
call symput('d',put(mydate,yymmddd10.));
run;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.