Not sure what it has to do with data mining, but here you go:
data have;
format Date date9.;
input Apps Code $ Date : date9.;
datalines;
590345 R33 31-Oct-23
590345 R34 31-Oct-23
590345 R33 30-Oct-23
590346 R21 28-Oct-23
590346 R19 20-Oct-23
;
run;
PROC MEANS data=have MAX noprint;
CLASS Apps Code;
var Date;
types Apps;
output out=statmax max= / autoname;
run;
PROC SQL noprint;
create table want as
select *
from have
where strip(put(Apps,6.))!!strip(put(Date,date9.))
IN (select strip(put(Apps,6.))!!strip(put(Date_Max,date9.))
from statmax);
QUIT;
/* end of program */
Koen
proc sql;
create table want as
select *
from have
group by apps
having date=max(date);
quit;
This will work in SAS.
@Ata62439 wrote:
Hi All,
Need your expertise to solve below data.
Apps Code Date
590345 R33 31-Oct-23
590345 R34 31-Oct-23
590345 R33 30-Oct-23
590346 R21 28-Oct-23
590346 R19 20-Oct-23
And my expected result will be
Apps Code Date
590345 R33 31-Oct-23
590345 R34 31-Oct-23
590346 R21 28-Oct-23
So as you can see I'm only want data with maximum date on each Apps variable.
Appreciate if you can help me to solve this
Thank you folks!
Oeps 🙁.
A bit more straightforward than my code (and less lengthy = more concise).
Koen
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.