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 open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.