The goal is to create a new column called typical. The new variable is to hold the max value among columns stages 0 through 4. I am also looking to create a variable called theMax that outputs the column title that includes the max value found across the five stage count variables. Data typical2000_1; Set typical2000; theMax = max(stage_0, stage_i, stage_ii, stage_iii, stage_iv); Run; data typical2 (keep = primsite stage_0 stage_i stage_ii stage_iii stage_iv themax); set typical2000_1; proc print; run; data typical3; set typical2; rename stage_0 = stage0; rename stage_i = stage1; rename stage_ii = stage2; rename stage_iii = stage3; rename stage_iv = stage4; run; data want; set typical3; array s stage0 stage1 stage2 stage3 stage4; maxvalue=max(of s(*)); maxvar=vname(s(whichn(maxvalue, of s(*)))); run;
... View more