<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Interpretation od weighted percentiles in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789272#M81412</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/315862"&gt;@WeiChen&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I did explain. I ran PROC UNIVARIATE.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;More information is needed. What PROC UNIVARIATE code gives a median of 3.2 for data set HAVE?????&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jan 2022 15:41:18 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-01-10T15:41:18Z</dc:date>
    <item>
      <title>Interpretation od weighted percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789265#M81408</link>
      <description>&lt;P&gt;I know PROC UNIVARIATE willgive me weighted percentiles, but how do I interpret the results? If the weighted median is 5.5, what does that say about my data?&amp;nbsp; I guess I don't understand how the weights are effecting the stiatistics.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data Have;
input x w;
datalines;
1 1
2 2
3 1
4 2
5 2
6 4
7 3
8 1
;
run;

proc univariate data=Have;
var x;
weight w;
ods select quantiles;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run this code I get&amp;nbsp;&lt;/P&gt;&lt;P&gt;Q3=6.5&lt;BR /&gt;Median=5.5&lt;BR /&gt;Q1=3.5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't get these values. Why is the median 5.5? And the other quartiles?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 15:43:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789265#M81408</guid>
      <dc:creator>WeiChen</dc:creator>
      <dc:date>2022-01-10T15:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Interpretation od weighted percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789267#M81409</link>
      <description>&lt;P&gt;For an interpretation of weighted percentiles, see the article &lt;A href="https://blogs.sas.com/content/iml/2016/08/29/weighted-percentiles.html" target="_self"&gt;"Weighted percentiles."&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The basic idea is to sort the data in increasing order (your data are already sorted). Then add up the cumulative weights and take the percentiles of the total weight.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your data, the weights sum to 16.&amp;nbsp; The 50th percentile is therefore the data value for which half the weight is on one side and half is on the other. If you run down your data, you see that any number between 5 and 6 has half the weight (8 units) on both sides.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other percentiles are similar. The 25th percentile is the data value for which 25% of the weight (=4 units) is below and 75% (=12 units) is above. For your data, any number between 3 and 4 has that property.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 15:35:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789267#M81409</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-01-10T15:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: Interpretation od weighted percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789269#M81410</link>
      <description>&lt;P&gt;You say your weighted median is 3.2? Explain how you calculated this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's how SAS gets these values ... it uses observation 1 one time and observation 2 two times and observation 6 four times, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As if the data set HAVE1 was provided instead of HAVE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
    set have;
    do i=1 to w;
        output;
    end;
    drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then, PROC UNIVARIATE on HAVE1 without the weight statement gives the same median as PROC UNIVARIATE on HAVE with the weight statement.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 15:39:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789269#M81410</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-10T15:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: Interpretation od weighted percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789271#M81411</link>
      <description>&lt;P&gt;I did explain. I ran PROC UNIVARIATE.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 15:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789271#M81411</guid>
      <dc:creator>WeiChen</dc:creator>
      <dc:date>2022-01-10T15:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Interpretation od weighted percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789272#M81412</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/315862"&gt;@WeiChen&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I did explain. I ran PROC UNIVARIATE.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;More information is needed. What PROC UNIVARIATE code gives a median of 3.2 for data set HAVE?????&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 15:41:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789272#M81412</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-10T15:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Interpretation od weighted percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789274#M81413</link>
      <description>&lt;P&gt;Oh, sorry. I used 3.2 as a hypothetical example. But then I decided to add example data and a PROC UNIVARIATE statement and forgot to update my sentenese. I will do that now.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 15:42:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789274#M81413</guid>
      <dc:creator>WeiChen</dc:creator>
      <dc:date>2022-01-10T15:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Interpretation od weighted percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789275#M81414</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;That is an amazinf article! So clera!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why wont UNIVARIATE create any graphs? I tried to make a histogram but it complains the the graphs cant be create if I use a weight.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 15:46:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789275#M81414</guid>
      <dc:creator>WeiChen</dc:creator>
      <dc:date>2022-01-10T15:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: Interpretation od weighted percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789285#M81415</link>
      <description>&lt;P&gt;Weighted graphics are a complicated topic for which statisticians have not reached a consensus. However, if you want to visualize the weighted distribution, you can create a weighted empirical CDF, as shown in the article that I mentioned earlier. For your data, the weighted ECDF would look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
input x w;
datalines;
1 1
2 2
3 1
4 2
5 2
6 4
7 3
8 1
;
run;

title "Weighted Percentiles";

/* put sum of weights into macro variable */
proc sql noprint;                              
 select sum(w) into :sumWt from Have;
quit;
%put &amp;amp;=sumWt;   /* display value in SAS log */

data Want;
set Have;
wt = w / &amp;amp;sumWt;   /* standardize Sum(wt)=1 */
run;

proc means data=Want p25 median p75;
var x;
weight wt;
run;

/* use IML to form weighted ECDF from data */
proc iml;
use Want; read all var {x wt}; close;
cumWt = cusum(wt);
cutPts = 0 // cumWt; 

/* generate data for WECDF */
t = do(0, 0.999, 0.001);
idx = bin(t, cutPts);
q = x[idx];

create WECDF var {t q x}; append; close;
QUIT;

title "Weighted ECDF";
proc sgplot data=wecdf noautolegend;
xaxis grid label="x";
yaxis grid offsetmin=0.1 label="Cumulative Proportion";
step x=q y=t;
fringe x / lineattrs=(color=black);
refline 0 / axis=y;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Jan 2022 16:10:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Interpretation-od-weighted-percentiles/m-p/789285#M81415</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-01-10T16:10:48Z</dc:date>
    </item>
  </channel>
</rss>

