How to adjust weights so the sum of weights = n of subjects in the sample

This SAS code adjusts weights (e.g., sample weights) such that the sum of weights equals the sample size.  Weight1 is the original weight and weight 2 is the result.

proc sql;
create table comp2 as
select *,
psweight * (count(weight1)/Sum(psweight1)) as weight2
from comp;

run;

Leave a Reply