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;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.