'Return Last Day of Month using Proc SQL in SAS
Probably a simple answer for you gurus! I'm trying to return the last day of the month using PROC SQL in SAS I have the following. It runs, but I do not see anything get returned.
What I really would like to do is have the End of Month Dates for the PAST 4 Years. It has got to be something simple but I can't figure it out !
PROC SQL;
SELECT DATEADD(MM,DATEDIFF(MM, -1, getdate()),-1) as ARS_DATE
;QUIT;
Thank you all for your help!
Solution 1:[1]
DATEADD isn't a valid SAS function AFAIK, it's an Oracle one I believe (or MS SQL?).
Use INTNX() instead. For generating a list of dates, a data step is more efficient.
data month_ends;
do i=1 to 48; *48 months = 4 years;
date_end = intnx('month', today(), -1*i, 'e');
format date_end yymmdd10.;
output;
end;
run;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Reeza |
