<?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: Compare medians using more than one class variable in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873129#M43190</link>
    <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13633"&gt;@StatDave&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm wondering since the output from PROC GENMOD is means, is it correct to use this proc (instead of&lt;SPAN&gt;&amp;nbsp;NPAR1WAY) to compare the median LOS? - and would I still use&amp;nbsp;PROC NPAR1WAY to compute medians for my data when I have ≥2 class variables, and then use PROC GENMOD to test for any difference? Is this correct to do?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 01 May 2023 11:03:09 GMT</pubDate>
    <dc:creator>Epi_Stats</dc:creator>
    <dc:date>2023-05-01T11:03:09Z</dc:date>
    <item>
      <title>Compare medians using more than one class variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873021#M43173</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I’m running some hypothesis tests on my data to compare the median length of stay (LOS) between 2 groups (treatment and control, categorical variable=treatment (y/n)), using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc NPAR1WAY data=LOS median wilcoxon;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class treatment;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var LOS;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I also want to test for differences in median LOS between the patients who were treated/untreated and then either survived or died (mortality variable), but I can’t figure out how to do this…&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that only one class variable is allowed when using the NPAR1WAY proc, and I get this error when I try to run the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc NPAR1WAY data=LOS median wilcoxon;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class treatment &lt;STRONG&gt;mortality&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;var LOS;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But is there another proc I can use to compare median LOS classified by both treatment and mortality variables?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I include some example data for context.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate all support and happy to clarify anything that may be unclear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data example_data;
	input ID treatment mortality los;
datalines;
1 1 1 96
2 1 1 71
3 1 1 92
4 0 0 99
5 1 0 41
6 0 0 37
7 1 0 17
8 1 1 65
9 0 1 7
10 1 0 12
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Apr 2023 23:40:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873021#M43173</guid>
      <dc:creator>Epi_Stats</dc:creator>
      <dc:date>2023-04-29T23:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Compare medians using more than one class variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873032#M43175</link>
      <description>You can make a new variable by combining these two variables.&lt;BR /&gt;new_class=catx(' ', treatment ,mortality);&lt;BR /&gt;&lt;BR /&gt;And include this new variable in CLASS .&lt;BR /&gt;Proc NPAR1WAY data=LOS median wilcoxon;&lt;BR /&gt;            class new_class ;&lt;BR /&gt;var LOS;&lt;BR /&gt;run;</description>
      <pubDate>Sun, 30 Apr 2023 03:19:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873032#M43175</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-04-30T03:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Compare medians using more than one class variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873054#M43176</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had tried this but was unsure if it was correct to combine these variables!..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I create the new concatenated variable and re-run the analysis, am I correct that it's the p value from the "Median One-Way Analysis" output that I read? (In my above example, p=0.0658, so there is no difference between the median LOS among the treated/untreated who died/survived).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2023 10:54:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873054#M43176</guid>
      <dc:creator>Epi_Stats</dc:creator>
      <dc:date>2023-04-30T10:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Compare medians using more than one class variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873063#M43178</link>
      <description>&lt;P&gt;Yeah. I think you are right.&lt;/P&gt;
&lt;P&gt;But&amp;nbsp;&lt;SPAN&gt;median&amp;nbsp; test of PROC NPAR1WAY is not very powerful, Maybe&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13633"&gt;@StatDave&lt;/a&gt;&amp;nbsp;know a better PROC .&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2023 14:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873063#M43178</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-04-30T14:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Compare medians using more than one class variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873067#M43180</link>
      <description>&lt;P&gt;If you are willing to assume a distribution for your LOS response, then you can probably get a more powerful test. For a non-negative response like length of stay, a distribution like gamma or inverse gaussian might be reasonable. With the data you show and using the combined predictors, the following finds a strongly significant effect - but you have to be comfortable with the distributional assumption. The LSMEANS statement gives multiple comparisons among the groups. The Mean column gives the estimates on the mean (original) scale.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc genmod;
class new_class;
model los=new_class / dist=gamma link=log type3;
lsmeans new_class / ilink diff;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 30 Apr 2023 15:38:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873067#M43180</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-04-30T15:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Compare medians using more than one class variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873088#M43183</link>
      <description>&lt;P&gt;Thank you very much - that is really interesting to be aware of these different (more powerful) tests!&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2023 19:07:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873088#M43183</guid>
      <dc:creator>Epi_Stats</dc:creator>
      <dc:date>2023-04-30T19:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Compare medians using more than one class variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873129#M43190</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13633"&gt;@StatDave&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm wondering since the output from PROC GENMOD is means, is it correct to use this proc (instead of&lt;SPAN&gt;&amp;nbsp;NPAR1WAY) to compare the median LOS? - and would I still use&amp;nbsp;PROC NPAR1WAY to compute medians for my data when I have ≥2 class variables, and then use PROC GENMOD to test for any difference? Is this correct to do?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 11:03:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873129#M43190</guid>
      <dc:creator>Epi_Stats</dc:creator>
      <dc:date>2023-05-01T11:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Compare medians using more than one class variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873229#M43193</link>
      <description>&lt;P&gt;Using the ilink option when the link is a log should result in a location estimate that approximates the median (geometric mean) rather than the expected value, but again it becomes a matter of distributional assumptions because it is not the same for gamma, inverse gaussian or log normal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you really, really want to look at differences in medians, you might consider bootstrapping as an approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 18:46:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873229#M43193</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2023-05-01T18:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Compare medians using more than one class variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873235#M43196</link>
      <description>&lt;P&gt;If you have the LOS and other variables, I wonder if survival analysis isn't an option as well, but with no censoring may be equivalent to genmod.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 19:00:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873235#M43196</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-05-01T19:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Compare medians using more than one class variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873282#M43200</link>
      <description>&lt;P&gt;GENMOD allows you to estimate the mean of whichever distribution is specified, not the median. The LSMEANS statement I showed provides estimates of the gamma mean at each level of the predictor. If you want to estimate the median, or other quantile, that is what quantile regression is for, which PROC QUANTREG can do.&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 22:13:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Compare-medians-using-more-than-one-class-variable/m-p/873282#M43200</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-05-01T22:13:18Z</dc:date>
    </item>
  </channel>
</rss>

