hi I haveatablewhere I want to get max date for example
have
id. Date type. comp
a. 07/15/15 A1. Yes
b 07/16/15. A2. No
a 07/18/15. A2. Yes
c 07/15/15. A3. No
what I want is to pull the max date which is he last time it was service
out put
a.07/18/15 A2. yes
b 07/16/15. A2 No
c 07/15/15. A3. No
thanks
Also try the sql method
proc sql;
create table want as select a.* from have as a, (select max(date) as date, id from have group by id) as b
where a.id=b.id and a.date=b.date ;
quit;
Thanks,
Jag
Please try
proc sort data=have;
by id date;
run;
data want;
set have;
by id date;
if last.id;
run;
Thanks,
Jag
Also try the sql method
proc sql;
create table want as select a.* from have as a, (select max(date) as date, id from have group by id) as b
where a.id=b.id and a.date=b.date ;
quit;
Thanks,
Jag
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.