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
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.