The program seems way too complicated. Why not just use PROC SUMMARY to find the MAX?
%let factor=735.5 ;
proc format ;
value $types
'SUV' ='1 SUV'
'Sedan' ='2 Sedan'
'Wagon' ='3 Wagon'
'Truck' ='4 Truck'
'Hybrid'='5 Hybrid'
'Sports'='6 Sports'
other ='0 Other'
;
run;
proc summary data=sashelp.cars nway ;
class make type ;
var horsepower ;
format type $types. ;
output out=max_power_by_types_cars max=maxpower ;
run;
data max_power_by_types_cars;
set max_power_by_types_cars;
watts=maxpower*&factor ;
run;
proc report data=max_power_by_types_cars ;
column make type,(maxpower watts);
define make / group;
define type / across format=$types. ;
format watts comma9.1 ;
run;
... View more