I have dataset like this:
data providers;
input prv_id mbr_cnt value;
datalines;
1100 25860 3.9025
4700 71855 8.8566
5500 72147 6.9918
6400 25144 4.5200
7000 58114 9.3391
7900 67222 7.5189
8300 54039 8.9301
8800 2204 3.2221
9400 71600 9.9682
10000 68807 7.6581
10200 16322 8.6505
10700 115118 12.4198
11100 148235 18.2053
11700 56441 8.6987
12100 58556 7.6724
12500 81865 10.1048
12900 18106 3.7881
13400 98701 12.9679
13900 10347 3.7001
14400 45516 6.3924
;
run;
I need to calculate percentile of each observation weighted by mbr_cnt
. Is there a way to do it in SAS? I tried to use proc rank data=providers groups=100 out=providers_percentile;
but that just gives me unweighted percentile.
PROC FREQ has a WEIGHT option and can calculate weighted cumulative percent.
proc freq data=providers;
ods output list=freqout;
weight mbr_cnt;
tables value * prv_id / list missing;
run;
Not sure if this exactly what you need.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.