SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

sas DI studio macro date

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

sas DI studio macro date

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


Accepted Solutions
Solution
‎02-06-2014 08:57 PM
Super User
Posts: 3,102

Re: sas DI studio macro date

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;

View solution in original post


All Replies
Solution
‎02-06-2014 08:57 PM
Super User
Posts: 3,102

Re: sas DI studio macro date

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;

New Contributor
Posts: 4

Re: sas DI studio macro date

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

Super User
Posts: 5,256

Re: sas DI studio macro date

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.

Data never sleeps
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 416 views
  • 6 likes
  • 3 in conversation