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 🙂
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.