This:
proc means data = &xvar.ranka noprint;
var wealthrank;
/* wealthrank_max*/
output out = wealthrank_max max = wealthrank_max;
run;
/* wealthrank _ max,wealthrank_max*/
data &xvar.rank;
set &xvar.ranka ;
if _n_ = 1 then set wealthrank_max;
wealthrank_frac = wealthrank/wealthrank_max;
run;
can be done in a single SQL:
proc sql;
create table &xvar.rank as
select
*,
wealthrank / max(wealthrank) as wealthrank_frac
from &xvar.ranka
;
quit;
PS: you must test this with your real data to see which of the two methods performs better. If the two-step PROC MEANS / DATA is significantly better, keep it.
... View more