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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.