I have data with a scaling factor, I want to analyze the distribution of the values , so I create a variable that indicates the quartile of the observation. This is explained here proc rank data=have groups=4 out=want;
var var1 var2;
ranks quartile_var1 quartile_var2;
run; This code produces this, ignoring the scaling My issue is, that I have an unrepresentative sample with some oversampling of certain demographics, but I have a scaling factor/ weight to adjust for this. So I'd like to calculate the quartiles while adjusting for the oversampling with my scaling factor. How to get this is explained here: proc means data=have p25 p50 p75;
weight wt;
var var1 var2;
run; of course I could first calculate the quartiles cutoff values and then use if statements to build the variable but the rank procedure is so elegant. rank doesn't seem to support weight though. suggestions how to do this quickly with few lines of code are well appreciated
... View more