I have the following output (see visual below SAS code) and I want to select the Top 5 obs for each manager. Can someone advise how to solve for this?
proc sql; create table DSNP_Agents1_Chart as
select distinct
a.county,
sum(a.mbr_end_inv) as Total,
a.Broker_Manager
From DSNP_Agents1 a
group by county, Broker_manager
order by Total desc
;quit;
proc sort data=DSNP_Agents1_Chart;
by Broker_manager;
run;
One way
proc rank data=sashelp.iris out=rank descending ties=low;
by species;
var SepalLength;
ranks r;
run;
proc sort data=rank out=want(drop = r);
where r <= 3;
by species r;
run;
Perhaps PROC RANK could help you?
One way
proc rank data=sashelp.iris out=rank descending ties=low;
by species;
var SepalLength;
ranks r;
run;
proc sort data=rank out=want(drop = r);
where r <= 3;
by species r;
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.