Hi Guys,
I'm trying to retrieve from my data the last day (not calender day) of each month. However the last day may not be the last day of the calender month, but the last day of the month given my data.
Eg. 20080601
20080627
20080622
20080712
20080729
20100128
20100125
I am trying to get a code to retrieve 20080627, 20080729 and 20109128.
Thanks a lot guys!
You could do it easily with proc sql:
proc sql;
create table want as
select max(date) as last_day format date9.
from have
group by year(date),month(date)
;
quit;
You could do it easily with proc sql:
proc sql;
create table want as
select max(date) as last_day format date9.
from have
group by year(date),month(date)
;
quit;
Hi Arthur,
Thanks for the code.
I was wondering if the date can be left in the original format YYYYMMDD. Because the code results in "2008 JAN 01" .
Thanks!
just change the format from date9. to yymmddn8.
Hi Art,
yymmdd8. doesn't work for me. I changed it to yymmddn8. to get 20080828. Thank you!
Linlin: Then I will change mine as well. As you can tell, it wasn't tested code. Too busy listening to the Michigan State football game.
Hope they will win the game. I know you graduated there.
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.