Hello, data have; input Team $ Points_Earned Points_Given_up ; datalines; Lions 20 10 Ravens 30 21 Broncos 30 5 Tigers 80 75 Baggers 80 55 ; data want (drop=i dif record) ; length record $ 30; do until(last); set have end=last; i+1; if dif <Points_Earned-Points_Given_up then do; dif=Points_Earned-Points_Given_up; record=i; end; else if dif=Points_Earned-Points_Given_up then record=cats(i,"|",record); end; i=1; if find(record,"|") then do while (not(missing(scan(record,i,"| ")))); acces=input(scan(record,i,"|"),8.); set have point=acces; output; i=i+1; end; else do; acces=input(compress(record),8.); set have point=acces; output; end; run;
... View more