Editor's Note: Thanks to all who contributed to this solution. If the variable is numeric, there are also a number of procedures that can output the MAX statistic, including PROC MEANS and PROC REPORT.
It's actually quite simple to do.
After sorting your data the way is should (V1 descending V3), you just need to check the value of the FIRST automatic variable to identify the first observation of the V1 group.
Here's you're code with the modification:
proc sort data=work.dataset1 out=work.temp;
by V1 descending V3;
run;
data work.dataset2;
set work.temp;
by V1;
if first.V1; * first member of the group then output;
run;
Cheers from Portugal
Daniel Santos @ www.cgd.pt
Editor's Note: Thanks to all who contributed to this solution. If the variable is numeric, there are also a number of procedures that can output the MAX statistic, including PROC MEANS and PROC REPORT.
It's actually quite simple to do.
After sorting your data the way is should (V1 descending V3), you just need to check the value of the FIRST automatic variable to identify the first observation of the V1 group.
Here's you're code with the modification:
proc sort data=work.dataset1 out=work.temp;
by V1 descending V3;
run;
data work.dataset2;
set work.temp;
by V1;
if first.V1; * first member of the group then output;
run;
Cheers from Portugal
Daniel Santos @ www.cgd.pt
proc sort data=set1 out=set_sort;
by v1 descending v3;
run;
proc sort data=set_sort out=set_highest1 nodup;
by v1;
run;
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.