Hi,
i have a fairly simple question. I would like to use
proc sql in SAS to extract the last business day from a set of records.
Not sure how I can do that.
Any help is appreciated
Thank you!
So you want the last working day of each month ? data have; input date : date9.; format date date9.; cards; 29jan2016 29apr2016 31may2016 30jun2016 30jul2016 ; run; proc sql; select * from have where date=intnx('weekday',intnx('month',date,0,'e'),0); quit;
Business day is a hard definition and not built into SAS because of various holidays around the world.
You can find the last weekday using the INTNX function, but its usually relative to some other day so I'm not sure what you're referencing. Use the WEEKDAY as the interval in INTNX along with the respective alignment to get the last one desired.
So you want the last working day of each month ? data have; input date : date9.; format date date9.; cards; 29jan2016 29apr2016 31may2016 30jun2016 30jul2016 ; run; proc sql; select * from have where date=intnx('weekday',intnx('month',date,0,'e'),0); quit;
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 25. 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.