data n;
lastmonth_endof_before_date=intnx('day',(today()-1)-1,'e');
format lastmonth_endof_before_date date9.;
run;
how to get last month before date of end of the month
ex: last month end is 31March2023 i am trying 30March2023 date
Add a -1 to your expression. SAS Dates are just integers 🙂
data _null_;
lastmonth_endof_before_date=intnx('month',today(),0,'e')-1;
put lastmonth_endof_before_date date9.;
run;
data n;
samedate=intnx('month',today(),0,'s');
prev_month=intnx('month',today(),-1,'s');
thismonth_begin=intnx('month',today(),0,'b');
nextmonth_begin=intnx('month',today(),1,'b');
prev_month_ending=intnx('month',today(),-1,'e');
next_month_ending=intnx('month',today(),1,'e');
last_2months=intnx('month',today(),-2);
lastmonth_endof_before_date=intnx('month',today(),-1,'e')-1;
format lastmonth_endof_before_date last_2months next_month_ending samedate thismonth_begin nextmonth_begin prev_month_ending prev_month: date9.;
run;
lastmonth_endof_before_date=intnx('month',today(),-1,'e')-1;
right 🙂 but you get the point 🙂
Add a -1 to your expression. SAS Dates are just integers 🙂
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: