<?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: cox ph simulation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/cox-ph-simulation/m-p/596126#M171594</link>
    <description>Man thank you so much I've been so stuck. This worked perfectly! Thankyou again</description>
    <pubDate>Sun, 13 Oct 2019 22:22:23 GMT</pubDate>
    <dc:creator>Ben12345</dc:creator>
    <dc:date>2019-10-13T22:22:23Z</dc:date>
    <item>
      <title>cox ph simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cox-ph-simulation/m-p/596005#M171552</link>
      <description>&lt;P&gt;Hi there, I am trying to calculate the power of a cox ph regression model by running a simulation of 1000 samples and calculating the % of pvalues&amp;lt;=0.05. However I cant seem to recall the stderr's of the parameter estimates or associated pvalues or 95% CI. The only thing I have been successful doing is the mean parameter estimate to calculate bias. Having trouble with what I can get from the outest command. Can anyone please help with the code to generate a table that shows percentage of pvalues &amp;lt;=0.05. Progress of my code shown below. Thanks heaps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;run simulation, then:&lt;/P&gt;&lt;P&gt;/*Sort dataset */&lt;BR /&gt;proc sort data=simcoxlog out=simcoxlog2; by sampleno; run;&lt;BR /&gt;/*run cox regression */&lt;BR /&gt;proc phreg data=simcoxlog2 outest=coxest noprint;&lt;BR /&gt;by sampleno;&lt;BR /&gt;model time*censored(1) = treatment;&lt;BR /&gt;run;&lt;BR /&gt;/*calculate means of sampling dist for cox regression */&lt;BR /&gt;proc means data=coxest mean stddev;&lt;BR /&gt;var treatment;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Oct 2019 23:26:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cox-ph-simulation/m-p/596005#M171552</guid>
      <dc:creator>Ben12345</dc:creator>
      <dc:date>2019-10-12T23:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: cox ph simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cox-ph-simulation/m-p/596059#M171577</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264010"&gt;@Ben12345&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Select the appropriate items from the list of &lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetVersion=14.3&amp;amp;docsetTarget=statug_phreg_details211.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;ODS tables&lt;/A&gt; and create datasets containing the desired information by means of an &lt;A href="https://documentation.sas.com/?docsetId=odsug&amp;amp;docsetTarget=p0oxrbinw6fjuwn1x23qam6dntyd.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;ODS OUTPUT statement&lt;/A&gt;. In your example the ODS table &lt;FONT face="courier new,courier"&gt;ParameterEstimates&lt;/FONT&gt; includes the parameter estimates, standard errors, (Wald Chi-Square) p-values and more. Instead of the NOPRINT option use an &lt;A href="https://documentation.sas.com/?docsetId=odsug&amp;amp;docsetTarget=n0edvjbwu4y1bun1qgmzbk3s3vix.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;ODS EXCLUDE&lt;/A&gt; (or ODS SELECT) statement to suppress listing or HTML output. The &lt;A href="https://documentation.sas.com/?docsetId=odsug&amp;amp;docsetTarget=n0z2vc5rs03yi9n16wntbtp5j00b.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;ODS NORESULTS&lt;/A&gt; statement can further improve performance by not sending output to the Results window. You may also want to suppress the notes about convergence (for each BY group) in the log.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods exclude all;
ods noresults;
options nonotes;

ods output ParameterEstimates=est;
        
proc phreg data=simcoxlog2;
by sampleno;
model time*censored(1) = treatment;
run;

ods exclude none;
ods results;
options notes;

proc format;
value signif
low-0.05   = 'significant'
0.05&amp;lt;-high = 'not significant';
run;

proc freq data=est;
format ProbChiSq signif.;
tables ProbChiSq;
run;

proc means data=est mean stddev;
var estimate;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Add more items of the form &lt;EM&gt;&lt;FONT face="courier new,courier"&gt;ODS_table = dataset&lt;/FONT&gt;&lt;/EM&gt; to the ODS OUTPUT statement if you need more statistics (e.g. global p-values from ODS table&amp;nbsp;&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;GlobalTests&lt;/FONT&gt;). In general, check the structure of the ODS output datasets (here: &lt;FONT face="courier new,courier"&gt;est&lt;/FONT&gt;) and add WHERE (or other) statements to the evaluating PROC FREQ, PROC MEANS etc. steps as appropriate, e.g., when you add more effects to the MODEL statement or when you use a CLASS variable with more than two levels.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2019 11:26:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cox-ph-simulation/m-p/596059#M171577</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-10-13T11:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: cox ph simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cox-ph-simulation/m-p/596125#M171593</link>
      <description>Man thank you so much I've been so stuck. This worked perfectly! Thankyou again&lt;BR /&gt;</description>
      <pubDate>Sun, 13 Oct 2019 22:22:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cox-ph-simulation/m-p/596125#M171593</guid>
      <dc:creator>Ben12345</dc:creator>
      <dc:date>2019-10-13T22:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: cox ph simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cox-ph-simulation/m-p/596126#M171594</link>
      <description>Man thank you so much I've been so stuck. This worked perfectly! Thankyou again</description>
      <pubDate>Sun, 13 Oct 2019 22:22:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cox-ph-simulation/m-p/596126#M171594</guid>
      <dc:creator>Ben12345</dc:creator>
      <dc:date>2019-10-13T22:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: cox ph simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cox-ph-simulation/m-p/596129#M171596</link>
      <description>&lt;P&gt;Thanks for being so helpful already, hoping I can stretch it with two more questions on this topic, sorry I'm new to SAS and have a long way to go.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question 1&lt;/P&gt;&lt;P&gt;I'm trying to compare power of cox and logistic regression. I want to run a logistic regression on the same data however the intercept values are being included in the pvalues. I can't seem to use the 'by treatment' statement it says 'variable treatment not found'.&lt;/P&gt;&lt;PRE&gt;/*Create dataset with ODS*/&lt;BR /&gt;ods output ParameterEstimates=logest;&lt;BR /&gt;/*Run logistic regression specify descending to find P(event=1)*/&lt;BR /&gt;proc logistic data=subset2 descending;&lt;BR /&gt;by sampleno;&lt;BR /&gt;model event = treatment;&lt;BR /&gt;run;&lt;BR /&gt;/*Unsuppress ODS listing*/&lt;BR /&gt;ods exclude none;&lt;BR /&gt;ods results;&lt;BR /&gt;options notes;&lt;BR /&gt;/*Create Power criteria*/&lt;BR /&gt;proc format;&lt;BR /&gt;value signif&lt;BR /&gt;low-0.05 = 'significant'&lt;BR /&gt;0.05&amp;lt;-high = 'not significant';&lt;BR /&gt;run;&lt;BR /&gt;/*Display Power results*/&lt;BR /&gt;proc freq data=logest;&lt;BR /&gt;format ProbChiSq signif.;&lt;BR /&gt;tables ProbChiSq;&lt;BR /&gt;run;&lt;BR /&gt;/*calculate means of sampling dist for log regression */&lt;BR /&gt;proc means data=logest mean stddev;&lt;BR /&gt;var estimate;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Question 2&lt;/P&gt;&lt;P&gt;I am also trying to do the logistic regression with a glm to get a RR estimate so in place of logistic regression command I have written:&lt;/P&gt;&lt;P&gt;/*Run log-binomial regression to look at RR*/&lt;BR /&gt;proc genmod data=subset descending;&lt;BR /&gt;model event = treatment/dist=binomial link=log;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;however it seems to only run 1 sample simulation not the 10,100, or 1000 specified. AN ideas why it might be doing this?&lt;/P&gt;&lt;P&gt;Thanks heaps,&lt;/P&gt;&lt;P&gt;Ben&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2019 23:56:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cox-ph-simulation/m-p/596129#M171596</guid>
      <dc:creator>Ben12345</dc:creator>
      <dc:date>2019-10-13T23:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: cox ph simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cox-ph-simulation/m-p/596189#M171621</link>
      <description>&lt;P&gt;You're welcome.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Re question 1: You can use a WHERE statement in the PROC FREQ step in order to restrict the p-values to those pertaining to variable &lt;FONT face="courier new,courier"&gt;treatment&lt;/FONT&gt;. Similarly, a CLASS statement in the PROC MEANS step would separate the estimates for intercept and treatment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create sample data for demonstration */

data subset2;
call streaminit(3141592);
do sampleno=1 to 1000;
  do _n_=1 to 100;
    treatment=_n_&amp;lt;=50;
    event=rand('bern',logistic(-1.789+1.234*treatment));
    output;
  end;
end;
run;

/* ... ODS and OPTIONS statements, PROC LOGISTIC and PROC FORMAT step as in your code ... */

proc freq data=logest;
where variable='treatment';
format ProbChiSq signif.;
tables ProbChiSq;
run;

proc means data=logest mean stddev;
class variable;
var estimate;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Re question 2: Insert the "&lt;FONT face="courier new,courier"&gt;by sampleno;&lt;/FONT&gt;" statement into the PROC GENMOD step as you did with PROC PHREG and PROC LOGISTIC. (Also, note that the &lt;FONT face="courier new,courier"&gt;ParameterEstimates&lt;/FONT&gt; ODS table of PROC GENMOD has a different structure than that of PROC LOGISTIC. In particular, the variable containing 'Intercept', 'treatment', etc. is named &lt;FONT face="courier new,courier"&gt;Parameter&lt;/FONT&gt;, not &lt;FONT face="courier new,courier"&gt;Variable&lt;/FONT&gt;.)&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 09:35:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cox-ph-simulation/m-p/596189#M171621</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-10-14T09:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: cox ph simulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cox-ph-simulation/m-p/596382#M171704</link>
      <description>&lt;P&gt;Once again thankyou so much! Your a legend!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 22:34:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cox-ph-simulation/m-p/596382#M171704</guid>
      <dc:creator>Ben12345</dc:creator>
      <dc:date>2019-10-14T22:34:04Z</dc:date>
    </item>
  </channel>
</rss>

