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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.