Reputation: 99
I want to create dates that will automatically be calculated by SAS based on the current date. The dates that I want to calculate are:
The next quarter in the format of YYQ (e.g. 161)
The current year in the format YYYY (e.g. 2015)
The Saturday before the previous Saturday in the format DDMMMYYYY (e.g. 24OCT2015)
The previous Friday in the format DDMMMYYYY (e.g. 30OCT2015)
The first day of the current quarter in the format DDMMMYYYY (e.g. 01OCT2015)
The first day of the current month in the format DDMMMYYYY (e.g. 01OCT2015)
The last day of the current month in the format DDMMMYYYY (e.g. 31OCT2015)
Upvotes: 0
Views: 130
Reputation: 99
Next Quarter
qtr = intnx('quarter',date(),1);
format qtr yyqn4.;
Current Year
year = date();
format year year4.;
Saturday before Previous Saturday
sat = intnx('week.7',date(),-2);
format sat date9.;
Previous Friday
fri = intnx('week.6',date(),-1);
format fri date9.;
First Day of Current Quarter
qstart = intnx('quarter',date(),0);
format qstart date9.;
First Day of Current Month
mstart = intnx('month',date(),0);
format mstart date9.;
Last Day of Current Month
mend = intnx('month',date(),0,'end');
format mend date9.;
Upvotes: 2