<?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 phreg post hocs in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/phreg-post-hocs/m-p/491717#M25526</link>
    <description>&lt;P&gt;I'm using phreg for the first time, and don't quite understand how it works. I'm fairly familiar with other procs (glm, etc), but phreg seems finicky.&amp;nbsp;Here's my code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data survival;
	input ID virus sex surv_days;
	label virus='0=Ctrl, 1=Virus' sex='0=M,1=F' surv_days='survival';
	datalines;
4264	1	1	3
4265	1	0	15
4269	0	0	15
4270	1	0	15
4272	0	1	15
4283	1	0	15
4284	0	1	15
4286	1	1	10
4288	0	1	5
4290	0	0	15
4293	1	1	7
4294	0	1	4
4296	1	1	4
4297	0	1	15
4299	1	0	8
4303	1	1	7
4304	0	1	15
4308	1	1	5
4310	0	0	15
4314	1	0	15
4316	0	0	15
4320	0	1	15
4325	0	0	15
4329	0	1	15
;
run;

data regimes;
	Virus=0;
	output;
	Virus=1;
	output;
	Sex=0;
	output;
	Sex=1;
	output;
run;

proc phreg data=survival plot(overlay)=survival;
	model surv_days=sex|virus;
	baseline covariates=regimes out=_null_;
	ods output ParameterEstimates=surv;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;From this, I have some questions:&lt;/P&gt;&lt;P&gt;1) my plot is only displaying 2 survival functions, labeled covariates 3 and 4. What happened to covariates 1 and 2?&lt;/P&gt;&lt;P&gt;2) why are my hazard ratios not displayed?&lt;/P&gt;&lt;P&gt;3) for my interaction (sex x virus), how do I determine which comparisons are significantly different? In proc glm, etc, I have used lsmeans / diff. That doesn't seem to work here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I feel like I'm doing something fundamentally wrong here. So any advice is greatly appreciated. Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 31 Aug 2018 19:06:47 GMT</pubDate>
    <dc:creator>matthew_m</dc:creator>
    <dc:date>2018-08-31T19:06:47Z</dc:date>
    <item>
      <title>phreg post hocs</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/phreg-post-hocs/m-p/491717#M25526</link>
      <description>&lt;P&gt;I'm using phreg for the first time, and don't quite understand how it works. I'm fairly familiar with other procs (glm, etc), but phreg seems finicky.&amp;nbsp;Here's my code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data survival;
	input ID virus sex surv_days;
	label virus='0=Ctrl, 1=Virus' sex='0=M,1=F' surv_days='survival';
	datalines;
4264	1	1	3
4265	1	0	15
4269	0	0	15
4270	1	0	15
4272	0	1	15
4283	1	0	15
4284	0	1	15
4286	1	1	10
4288	0	1	5
4290	0	0	15
4293	1	1	7
4294	0	1	4
4296	1	1	4
4297	0	1	15
4299	1	0	8
4303	1	1	7
4304	0	1	15
4308	1	1	5
4310	0	0	15
4314	1	0	15
4316	0	0	15
4320	0	1	15
4325	0	0	15
4329	0	1	15
;
run;

data regimes;
	Virus=0;
	output;
	Virus=1;
	output;
	Sex=0;
	output;
	Sex=1;
	output;
run;

proc phreg data=survival plot(overlay)=survival;
	model surv_days=sex|virus;
	baseline covariates=regimes out=_null_;
	ods output ParameterEstimates=surv;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;From this, I have some questions:&lt;/P&gt;&lt;P&gt;1) my plot is only displaying 2 survival functions, labeled covariates 3 and 4. What happened to covariates 1 and 2?&lt;/P&gt;&lt;P&gt;2) why are my hazard ratios not displayed?&lt;/P&gt;&lt;P&gt;3) for my interaction (sex x virus), how do I determine which comparisons are significantly different? In proc glm, etc, I have used lsmeans / diff. That doesn't seem to work here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I feel like I'm doing something fundamentally wrong here. So any advice is greatly appreciated. Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 19:06:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/phreg-post-hocs/m-p/491717#M25526</guid>
      <dc:creator>matthew_m</dc:creator>
      <dc:date>2018-08-31T19:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: phreg post hocs</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/phreg-post-hocs/m-p/491728#M25527</link>
      <description>&lt;P&gt;Please remember to check your log. Your code generates the following notes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;NOTE: Hazard ratios that cannot be conveniently calculated or displayed are set to missing in the ParameterEstimates table. &lt;FONT color="#800080"&gt;Use the HAZARDRATIO statement to compute the needed hazard ratios.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;FONT color="#800080"&gt;&lt;STRONG&gt;NOTE: Row 1 in the COVARIATES= data set has invalid covariate values.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#800080"&gt;&lt;STRONG&gt;NOTE: Row 2 in the COVARIATES= data set has invalid covariate values.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;For the COVARIATES data set, it needs to include values for all parameters, not just the one of interest. Ie SEX=0 and what about the VIRUS value? You do have to provide a value or level for that otherwise it won't work. Since you have two variables with two levels each, you have four baseline possibilities.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can create the REGIMES data set as below and get the values you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the HazardRatio, add the HazardRatio statement as indicated by the log. You also should include CLASS statements to identify your categorical variables as such. Then SAS will treat it as categorical and things make more sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Modified code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data regimes;
    do virus=0 to 1;
        do sex=0 to 1;
            output;
        end;
    end;
run;

proc phreg data=survival plot(overlay)=survival;
    class virus sex;
	model surv_days=sex|virus;
	baseline covariates=regimes out=_null_;
	ods output ParameterEstimates=surv;
    hazardratio sex /at (virus='0');
    hazardratio sex /at (virus='1');
    hazardratio virus /at (sex='1');
    hazardratio virus /at (sex='0');
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/221531"&gt;@matthew_m&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm using phreg for the first time, and don't quite understand how it works. I'm fairly familiar with other procs (glm, etc), but phreg seems finicky.&amp;nbsp;Here's my code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data survival;
	input ID virus sex surv_days;
	label virus='0=Ctrl, 1=Virus' sex='0=M,1=F' surv_days='survival';
	datalines;
4264	1	1	3
4265	1	0	15
4269	0	0	15
4270	1	0	15
4272	0	1	15
4283	1	0	15
4284	0	1	15
4286	1	1	10
4288	0	1	5
4290	0	0	15
4293	1	1	7
4294	0	1	4
4296	1	1	4
4297	0	1	15
4299	1	0	8
4303	1	1	7
4304	0	1	15
4308	1	1	5
4310	0	0	15
4314	1	0	15
4316	0	0	15
4320	0	1	15
4325	0	0	15
4329	0	1	15
;
run;

data regimes;
	Virus=0;
	output;
	Virus=1;
	output;
	Sex=0;
	output;
	Sex=1;
	output;
run;

proc phreg data=survival plot(overlay)=survival;
	model surv_days=sex|virus;
	baseline covariates=regimes out=_null_;
	ods output ParameterEstimates=surv;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;From this, I have some questions:&lt;/P&gt;
&lt;P&gt;1) my plot is only displaying 2 survival functions, labeled covariates 3 and 4. What happened to covariates 1 and 2?&lt;/P&gt;
&lt;P&gt;2) why are my hazard ratios not displayed?&lt;/P&gt;
&lt;P&gt;3) for my interaction (sex x virus), how do I determine which comparisons are significantly different? In proc glm, etc, I have used lsmeans / diff. That doesn't seem to work here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I feel like I'm doing something fundamentally wrong here. So any advice is greatly appreciated. Thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 19:43:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/phreg-post-hocs/m-p/491728#M25527</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-31T19:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: phreg post hocs</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/phreg-post-hocs/m-p/491729#M25528</link>
      <description>&lt;P&gt;Please remember to check your log. Your code generates the following notes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;NOTE: Hazard ratios that cannot be conveniently calculated or displayed are set to missing in the ParameterEstimates table. &lt;FONT color="#800080"&gt;Use the HAZARDRATIO statement to compute the needed hazard ratios.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;FONT color="#800080"&gt;&lt;STRONG&gt;NOTE: Row 1 in the COVARIATES= data set has invalid covariate values.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#800080"&gt;&lt;STRONG&gt;NOTE: Row 2 in the COVARIATES= data set has invalid covariate values.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;For the COVARIATES data set, it needs to include values for all parameters, not just the one of interest. Ie SEX=0 and what about the VIRUS value? You do have to provide a value or level for that otherwise it won't work. Since you have two variables with two levels each, you have four baseline possibilities.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can create the REGIMES data set as below and get the values you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the HazardRatio, add the HazardRatio statement as indicated by the log. You also should include CLASS statements to identify your categorical variables as such. Then SAS will treat it as categorical and things make more sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Modified code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data regimes;
    do virus=0 to 1;
        do sex=0 to 1;
            output;
        end;
    end;
run;

proc phreg data=survival plot(overlay)=survival;
    class virus sex;
	model surv_days=sex|virus;
	baseline covariates=regimes out=_null_;
	ods output ParameterEstimates=surv;
    hazardratio sex /at (virus='0');
    hazardratio sex /at (virus='1');
    hazardratio virus /at (sex='1');
    hazardratio virus /at (sex='0');
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/221531"&gt;@matthew_m&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm using phreg for the first time, and don't quite understand how it works. I'm fairly familiar with other procs (glm, etc), but phreg seems finicky.&amp;nbsp;Here's my code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data survival;
	input ID virus sex surv_days;
	label virus='0=Ctrl, 1=Virus' sex='0=M,1=F' surv_days='survival';
	datalines;
4264	1	1	3
4265	1	0	15
4269	0	0	15
4270	1	0	15
4272	0	1	15
4283	1	0	15
4284	0	1	15
4286	1	1	10
4288	0	1	5
4290	0	0	15
4293	1	1	7
4294	0	1	4
4296	1	1	4
4297	0	1	15
4299	1	0	8
4303	1	1	7
4304	0	1	15
4308	1	1	5
4310	0	0	15
4314	1	0	15
4316	0	0	15
4320	0	1	15
4325	0	0	15
4329	0	1	15
;
run;

data regimes;
	Virus=0;
	output;
	Virus=1;
	output;
	Sex=0;
	output;
	Sex=1;
	output;
run;

proc phreg data=survival plot(overlay)=survival;
	model surv_days=sex|virus;
	baseline covariates=regimes out=_null_;
	ods output ParameterEstimates=surv;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;From this, I have some questions:&lt;/P&gt;
&lt;P&gt;1) my plot is only displaying 2 survival functions, labeled covariates 3 and 4. What happened to covariates 1 and 2?&lt;/P&gt;
&lt;P&gt;2) why are my hazard ratios not displayed?&lt;/P&gt;
&lt;P&gt;3) for my interaction (sex x virus), how do I determine which comparisons are significantly different? In proc glm, etc, I have used lsmeans / diff. That doesn't seem to work here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I feel like I'm doing something fundamentally wrong here. So any advice is greatly appreciated. Thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 19:43:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/phreg-post-hocs/m-p/491729#M25528</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-31T19:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: phreg post hocs</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/phreg-post-hocs/m-p/492364#M25547</link>
      <description>&lt;P&gt;This is incredibly helpful! I was indeed doing something fundamentally wrong! No wonder I couldn't get those hazard ratios to calculate when I tried...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You've solved issues 1 and 2, but what about issue 3? I hate to ask for more help on this, considering the detailed response you already provided, but do you have any thoughts on identifying which comparisons differ in the sex*virus interaction? You don't necessarily need to write the code for me, just point me in the right direction. Thanks ahead of time!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 16:33:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/phreg-post-hocs/m-p/492364#M25547</guid>
      <dc:creator>matthew_m</dc:creator>
      <dc:date>2018-09-04T16:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: phreg post hocs</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/phreg-post-hocs/m-p/492370#M25548</link>
      <description>&lt;P&gt;Look at the HazardRatios and the CI for the HR to answer #3.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/221531"&gt;@matthew_m&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;This is incredibly helpful! I was indeed doing something fundamentally wrong! No wonder I couldn't get those hazard ratios to calculate when I tried...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You've solved issues 1 and 2, but what about issue 3? I hate to ask for more help on this, considering the detailed response you already provided, but do you have any thoughts on identifying which comparisons differ in the sex*virus interaction? You don't necessarily need to write the code for me, just point me in the right direction. Thanks ahead of time!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 16:46:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/phreg-post-hocs/m-p/492370#M25548</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-04T16:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: phreg post hocs</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/phreg-post-hocs/m-p/492376#M25549</link>
      <description>&lt;P&gt;Ah! I see! I was so focused on the p value, that I completely overlooked the confidence limits. Thanks! You're a life-saver!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 16:53:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/phreg-post-hocs/m-p/492376#M25549</guid>
      <dc:creator>matthew_m</dc:creator>
      <dc:date>2018-09-04T16:53:56Z</dc:date>
    </item>
  </channel>
</rss>

