Hi ,
I have a requirement in SAS DI where I need to create dates like
2 months before the current date
3 months before the current date
4 months before the current date
Can some one provide me the way to derive these dates based on the system date.
Thanks,Ashish
How about something like this:
%let month_back2 = %sysfunc(intnx(MONTH, "&sysdate9."d, - 2, SAME), date9.);
%let month_back3 = %sysfunc(intnx(MONTH, "&sysdate9."d, - 3, SAME), date9.);
%let month_back4 = %sysfunc(intnx(MONTH, "&sysdate9."d, - 4, SAME), date9.);
%put month_back2 = &month_back2;
%put month_back3 = &month_back3;
%put month_back4 = &month_back4;
How about something like this:
%let month_back2 = %sysfunc(intnx(MONTH, "&sysdate9."d, - 2, SAME), date9.);
%let month_back3 = %sysfunc(intnx(MONTH, "&sysdate9."d, - 3, SAME), date9.);
%let month_back4 = %sysfunc(intnx(MONTH, "&sysdate9."d, - 4, SAME), date9.);
%put month_back2 = &month_back2;
%put month_back3 = &month_back3;
%put month_back4 = &month_back4;
Hi,
Thanks for getting back to me,much appreciated!
So I will copy this in the precode of the job, and it should work.
One last thing on this question,can the same not be done by using the parameters tab of the job or one has to write this code manually?
Thanks,Ashish
in my mind, parameters are usfell when connection to job using a data set as a control table, and the loop transform.
You could use parameters, but I can't see the benefit in your case.
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!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.