<?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: NPPAR1WAY - direction of RANK SUM test difference in SHIFT in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/NPPAR1WAY-direction-of-RANK-SUM-test-difference-in-SHIFT/m-p/983323#M49212</link>
    <description>&lt;P&gt;I think that is due to&amp;nbsp;treatnp=3 appeared before&amp;nbsp;treatnp=2 in the last visit.&lt;/P&gt;
&lt;P&gt;Here is an example:&lt;/P&gt;
&lt;PRE&gt;data maze3 ;
input avisitn avisit $ treatnp chg;
cards;
1 visit1 2 23
1 visit1 2 23
1 visit1 2 23
1 visit1 3 123
1 visit1 3 123
1 visit1 3 123
2 visit2 &lt;STRONG&gt;3&lt;/STRONG&gt; 23
2 visit2 3 23
2 visit2 3 23
2 visit2 &lt;STRONG&gt;2&lt;/STRONG&gt; 123
2 visit2 2 123
2 visit2 2 123
;

proc npar1way data = maze3 wilcoxon  HL  ALPHA = 0.05;
by avisitn avisit;
class treatnp;
var chg;
EXACT WILCOXON;
ods output wilcoxontest =WT23  HodgesLehmann = HL23;
run;
&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1770795615047.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/113138i465C5F9BDEC66C9B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1770795615047.png" alt="Ksharp_0-1770795615047.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_2-1770795669313.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/113140i568F87753DCF2299/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_2-1770795669313.png" alt="Ksharp_2-1770795669313.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you changed the order of 2 and 3 in the last visit, you got this:&lt;/P&gt;
&lt;PRE&gt;data maze3 ;
input avisitn avisit $ treatnp chg;
cards;
1 visit1 2 23
1 visit1 2 23
1 visit1 2 23
1 visit1 3 123
1 visit1 3 123
1 visit1 3 123
2 visit2 &lt;STRONG&gt;2&lt;/STRONG&gt; 23
2 visit2 2 23
2 visit2 2 23
2 visit2 &lt;STRONG&gt;3&lt;/STRONG&gt; 123
2 visit2 3 123
2 visit2 3 123
;
&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_3-1770795750538.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/113141i35A483A8FAA64313/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_3-1770795750538.png" alt="Ksharp_3-1770795750538.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_4-1770795771995.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/113142iF2BF67AD4E289D50/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_4-1770795771995.png" alt="Ksharp_4-1770795771995.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Feb 2026 07:43:14 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2026-02-11T07:43:14Z</dc:date>
    <item>
      <title>NPPAR1WAY - direction of RANK SUM test difference in SHIFT</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/NPPAR1WAY-direction-of-RANK-SUM-test-difference-in-SHIFT/m-p/983288#M49210</link>
      <description>&lt;P&gt;I am using the following code to compute exact CI and produce the change in median (shift). This code appears to operate correctly for all visits except the last one where it switches the sign on the shift.&lt;/P&gt;
&lt;P&gt;Last Visit&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV id="IDX17"&gt;
&lt;TABLE class="table" aria-label="Hodges-Lehmann Estimation"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c b header" colspan="4" scope="colgroup"&gt;Hodges-Lehmann Estimation&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="c b data" colspan="4"&gt;&lt;EM&gt;Location Shift (3 - 2) -2.0000 (want 2-3 for this one also and all other stats)&lt;/EM&gt;&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="c b header" colspan="2" scope="colgroup"&gt;95% Confidence Limits&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Interval Midpoint&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Asymptotic&lt;BR /&gt;Standard Error&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;-3.0000&lt;/TD&gt;
&lt;TD class="r data"&gt;-1.0000&lt;/TD&gt;
&lt;TD class="r data"&gt;-2.0000&lt;/TD&gt;
&lt;TD class="r data"&gt;0.5102&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;All other visits&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV id="IDX3"&gt;
&lt;TABLE class="table" aria-label="Hodges-Lehmann Estimation"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c b header" colspan="4" scope="colgroup" width="345.047px" height="19px"&gt;Hodges-Lehmann Estimation&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="c b data" colspan="4" width="345.047px" height="19px"&gt;&lt;EM&gt;Location Shift (2 - 3) 0.0000 (this is the correct order)&lt;/EM&gt;&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="c b header" colspan="2" scope="colgroup" width="144.234px" height="38px"&gt;95% Confidence Limits&lt;/TH&gt;
&lt;TH class="r b header" scope="col" width="108.375px" height="38px"&gt;Interval Midpoint&lt;/TH&gt;
&lt;TH class="r b header" scope="col" width="92.4375px" height="38px"&gt;Asymptotic&lt;BR /&gt;Standard Error&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="73.2188px" height="30px" class="r data"&gt;-1.0000&lt;/TD&gt;
&lt;TD width="71.0156px" height="30px" class="r data"&gt;0.0000&lt;/TD&gt;
&lt;TD width="108.375px" height="30px" class="r data"&gt;-0.5000&lt;/TD&gt;
&lt;TD width="92.4375px" height="30px" class="r data"&gt;0.2551&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;How do I force SAS to always take the differences as 2-3 so it does not switch to 3-2?&lt;/DIV&gt;
&lt;DIV&gt;proc npar1way data = maze3 wilcoxon&amp;nbsp; HL&amp;nbsp; ALPHA = 0.05;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; by avisitn avisit;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; class treatnp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; where treatnp in (2 3) and acat = 'Study Eye';&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; var chg;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; EXACT WILCOXON;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; ods output wilcoxontest =WT23&amp;nbsp; HodgesLehmann = HL23;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;run;&lt;/DIV&gt;</description>
      <pubDate>Tue, 10 Feb 2026 18:26:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/NPPAR1WAY-direction-of-RANK-SUM-test-difference-in-SHIFT/m-p/983288#M49210</guid>
      <dc:creator>_Hopper</dc:creator>
      <dc:date>2026-02-10T18:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: NPPAR1WAY - direction of RANK SUM test difference in SHIFT</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/NPPAR1WAY-direction-of-RANK-SUM-test-difference-in-SHIFT/m-p/983323#M49212</link>
      <description>&lt;P&gt;I think that is due to&amp;nbsp;treatnp=3 appeared before&amp;nbsp;treatnp=2 in the last visit.&lt;/P&gt;
&lt;P&gt;Here is an example:&lt;/P&gt;
&lt;PRE&gt;data maze3 ;
input avisitn avisit $ treatnp chg;
cards;
1 visit1 2 23
1 visit1 2 23
1 visit1 2 23
1 visit1 3 123
1 visit1 3 123
1 visit1 3 123
2 visit2 &lt;STRONG&gt;3&lt;/STRONG&gt; 23
2 visit2 3 23
2 visit2 3 23
2 visit2 &lt;STRONG&gt;2&lt;/STRONG&gt; 123
2 visit2 2 123
2 visit2 2 123
;

proc npar1way data = maze3 wilcoxon  HL  ALPHA = 0.05;
by avisitn avisit;
class treatnp;
var chg;
EXACT WILCOXON;
ods output wilcoxontest =WT23  HodgesLehmann = HL23;
run;
&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1770795615047.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/113138i465C5F9BDEC66C9B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1770795615047.png" alt="Ksharp_0-1770795615047.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_2-1770795669313.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/113140i568F87753DCF2299/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_2-1770795669313.png" alt="Ksharp_2-1770795669313.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you changed the order of 2 and 3 in the last visit, you got this:&lt;/P&gt;
&lt;PRE&gt;data maze3 ;
input avisitn avisit $ treatnp chg;
cards;
1 visit1 2 23
1 visit1 2 23
1 visit1 2 23
1 visit1 3 123
1 visit1 3 123
1 visit1 3 123
2 visit2 &lt;STRONG&gt;2&lt;/STRONG&gt; 23
2 visit2 2 23
2 visit2 2 23
2 visit2 &lt;STRONG&gt;3&lt;/STRONG&gt; 123
2 visit2 3 123
2 visit2 3 123
;
&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_3-1770795750538.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/113141i35A483A8FAA64313/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_3-1770795750538.png" alt="Ksharp_3-1770795750538.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_4-1770795771995.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/113142iF2BF67AD4E289D50/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_4-1770795771995.png" alt="Ksharp_4-1770795771995.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Feb 2026 07:43:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/NPPAR1WAY-direction-of-RANK-SUM-test-difference-in-SHIFT/m-p/983323#M49212</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2026-02-11T07:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: NPPAR1WAY - direction of RANK SUM test difference in SHIFT</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/NPPAR1WAY-direction-of-RANK-SUM-test-difference-in-SHIFT/m-p/983353#M49215</link>
      <description>&lt;P&gt;It is caused by the counts in the different treatments. The difference and CIs are computed on Yi - Xi where Yi in this case is the treatment with fewer records. I had to put some extra logic in the code to reverse the signs so the median difference and CIs would be in the correct direction. There isn't a way to make SAS do it the same way every time as the NPAR1WAY procedure does this on its own.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, if we want TMT1 - TMT2 and n(TMT1)&amp;gt;=n(TMT2) SAS will always run the computation as TMT2-TMT1. From here the signs have to be reversed for both the CIs and the shift value (consequently LCL becomes UCL and UCL becomes LCL). This is what I learned from the statisticians at SAS.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Feb 2026 18:07:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/NPPAR1WAY-direction-of-RANK-SUM-test-difference-in-SHIFT/m-p/983353#M49215</guid>
      <dc:creator>_Hopper</dc:creator>
      <dc:date>2026-02-11T18:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: NPPAR1WAY - direction of RANK SUM test difference in SHIFT</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/NPPAR1WAY-direction-of-RANK-SUM-test-difference-in-SHIFT/m-p/983360#M49217</link>
      <description>&lt;P&gt;The documentation seems to say that you can pick which value of the class variable is the reference value.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;You can specify the reference class by using the&amp;nbsp;&lt;/SPAN&gt;&lt;A tabindex="0" href="https://documentation.sas.com/doc/en/statug/15.2/statug_npar1way_syntax01.htm#statug.npar1way.np1hl" target="_blank"&gt;HL(REFCLASS=)&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;option. REFCLASS=1 specifies the first class that is listed in the "Wilcoxon Scores" table, and REFCLASS=2 specifies the second class. REFCLASS='&lt;/SPAN&gt;&lt;SPAN class=" aa-argument"&gt;class-value&lt;/SPAN&gt;&lt;SPAN&gt;' identifies the reference class by the formatted value of the&amp;nbsp;&lt;/SPAN&gt;&lt;A tabindex="0" href="https://documentation.sas.com/doc/en/statug/15.2/statug_npar1way_syntax03.htm" target="_blank"&gt;CLASS&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;variable.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But trying it using&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;'s example program it does not seem to actually make any difference.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Feb 2026 18:32:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/NPPAR1WAY-direction-of-RANK-SUM-test-difference-in-SHIFT/m-p/983360#M49217</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-02-11T18:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: NPPAR1WAY - direction of RANK SUM test difference in SHIFT</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/NPPAR1WAY-direction-of-RANK-SUM-test-difference-in-SHIFT/m-p/983367#M49218</link>
      <description>&lt;P&gt;Using the option (refclass =1) didn't make any difference. The same ones are 3-1 instead of 1-3.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Feb 2026 19:28:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/NPPAR1WAY-direction-of-RANK-SUM-test-difference-in-SHIFT/m-p/983367#M49218</guid>
      <dc:creator>_Hopper</dc:creator>
      <dc:date>2026-02-11T19:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: NPPAR1WAY - direction of RANK SUM test difference in SHIFT</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/NPPAR1WAY-direction-of-RANK-SUM-test-difference-in-SHIFT/m-p/983371#M49220</link>
      <description>&lt;P&gt;Update refclass does make a difference if the data are sorted first like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data = xxx;&lt;/P&gt;
&lt;P&gt;by avisitn avisit descending treatment;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*this puts the control group first by visit then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc npar1way data = xxx wilcoxon HL(refclass = 1) alpha = 0.05 &amp;lt;&amp;lt;&amp;lt;&amp;lt;-now it computes the difference I want every time regardless of record counts.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Feb 2026 20:53:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/NPPAR1WAY-direction-of-RANK-SUM-test-difference-in-SHIFT/m-p/983371#M49220</guid>
      <dc:creator>_Hopper</dc:creator>
      <dc:date>2026-02-11T20:53:23Z</dc:date>
    </item>
  </channel>
</rss>

