We can do this thing through array too..for eg.

data a;
input year jan feb mar apr may jun jul aug sep oct nov dec;

cards;
1997 123 343 324 5434 3454 1212 654 3443 212 4564 123 555
1998 253 2566 2535 5586 5595 9658 5874 5826 9562 9856 5585 5576
1999 524 548 2132 2413 6888 9989 7767 5576 990 6567 9897 9899
2000 3213 213 3122 3322 5434 7565 8759 8878 9494 4994 3233 2222
;
run;

data b ;
set a;

array mon(12) jan--dec;
array var(12) $var1-var12('jan' 'feb' 'mar' 'apr' 'may' 'jun' 'jul'
'aug' 'sep' 'oct' 'nov' 'dec');

do i = 1 to 12;

if max(of mon(*)) = mon(i) then Max = Var(i);
end;
run;

We can always put all the variables in another array and access them with the same iterator as the Max.

Or we can you vname() for the Variable name.

data c;
set a;

array max(12) jan--dec;

do i = 1 to 12;

if max(of max(*)) = max(i) then Max = Vname(max(i)); /* This will return the variable name */
end;
run;