<?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: Calculating Concordance (C-index) for cox models in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Calculating-Concordance-C-index-for-cox-models/m-p/33722#M20007</link>
    <description>&lt;P&gt;Here is my review of the SAS code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//This step does a cartesian join of the evtset and obs data tables,
// but eliminates any rows where the column idn_j=idn
// To do this in JMP would be a 2 step process.  Use 
//  Tables==&amp;gt;Join
// and specify to perform a Cartesian Join, then find all rows in 
// the new data table where idn_j==idn and delete them
proc sql;
 create table allset as
 select idn_j, y_j, x_j, idn as idn_i, surv as y_i, combdays as x_i
 from evtset, obs
 where idn_j&amp;lt;&amp;gt;idn;
quit;

// This step just creates a new column called "concord"
// SAS has to create a new table to do this, where JMP could
// just add it to the allset data table from the join step
data concord;
 set allset;
 if (x_i&amp;lt;x_j and y_i&amp;gt;y_j) or (x_i&amp;gt;x_j and y_i&amp;lt;y_j) then concord=1;
 else concord=0;
run; 

// This step simply creates macro variables for the number of rows
// that have been set to a concord value of 1 and 0 and a third 
// variable as to the number of total rows
// JMP would just do this with 3 statements
// ch=N rows(allset&amp;lt;&amp;lt;get rows where(concord==1));
// dh=N Rows(allset)-ch;
// uspairs=N Rows(allset);
data _null_;
 set concord end=eof;
 retain nch ndh;
 if _N_=1 then do;
  nch=0;
  ndh=0;
 end;
 if concord=1 then nch+1;
 if concord=0 then ndh+1;
 if eof=1 then do;
  call symput('ch',trim(left(nch)));
  call symput('dh',trim(left(ndh)));
  call symput('uspairs',trim(left(_n_)));
 end; 
run;

// This step references the original data table "sample" which
// was the input table to the phreg procedure that was run on it.
// This step simply gets the numer of rows from that table
// JMP code would simply be
// totobs=nrows(sample);
data _null_;
 set sample end=eof;
 if eof=1 then call symput('totobs',trim(left(_n_)));
run;

// This simply writes out the calculated macro values
%put &amp;amp;ch &amp;amp;dh &amp;amp;uspairs &amp;amp;totobs;

// This step creates an output data table with one row with the columns
// being calculated starting with the macro variable values
data calculat;
 ch=input("&amp;amp;ch",12.0);
 dh=input("&amp;amp;dh",12.0);
 uspairs=input("&amp;amp;uspairs",12.0);
 totobs=input("&amp;amp;totobs",10.0);
 pc=ch/(totobs*(totobs-1));
 pd=dh/(totobs*(totobs-1));
 c_hat=pc/(pc+pd);

 w=(2*1.96**2)/(totobs*(pc+pd));
 low_ci_w=((w+2*c_hat)/(2*(1+w)))-(sqrt((w**2+4*w*c_hat*(1-c_hat))/(2*(1+w))));
 upper_ci_w=((w+2*c_hat)/(2*(1+w)))+(sqrt((w**2+4*w*c_hat*(1-c_hat))/(2*(1+w))));
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 15 Dec 2016 15:37:47 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2016-12-15T15:37:47Z</dc:date>
    <item>
      <title>Calculating Concordance (C-index) for cox models</title>
      <link>https://community.jmp.com/t5/Discussions/Calculating-Concordance-C-index-for-cox-models/m-p/33664#M19969</link>
      <description>&lt;P&gt;I'm trying to calculate concordance index in JMP 10 of a cox model. &amp;nbsp;I found this paper for SAS:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings09/236-2009.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings09/236-2009.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;but am not quite understanding what it is that it's doing. &amp;nbsp; Any help is appreciated. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
 create table allset as
 select idn_j, y_j, x_j, idn as idn_i, surv as y_i, combdays as x_i
 from evtset, obs
 where idn_j&amp;lt;&amp;gt;idn;
quit;
data concord;
 set allset;
 if (x_i&amp;lt;x_j and y_i&amp;gt;y_j) or (x_i&amp;gt;x_j and y_i&amp;lt;y_j) then concord=1;
 else concord=0;
run; 

data _null_;
set concord end=eof;
retain nch ndh;
if _N_=1 then do;
nch=0;
ndh=0;
end;
if concord=1 then nch+1;
if concord=0 then ndh+1;
if eof=1 then do;
 call symput('ch',trim(left(nch)));
 call symput('dh',trim(left(ndh)));
 call symput('uspairs',trim(left(_n_)));
 end; 
run;
data _null_;
set sample end=eof;
if eof=1 then call symput('totobs',trim(left(_n_)));
run;
%put &amp;amp;ch &amp;amp;dh &amp;amp;uspairs &amp;amp;totobs;
data calculat;
ch=input("&amp;amp;ch",12.0);
dh=input("&amp;amp;dh",12.0);
uspairs=input("&amp;amp;uspairs",12.0);
totobs=input("&amp;amp;totobs",10.0);
pc=ch/(totobs*(totobs-1));
pd=dh/(totobs*(totobs-1));
c_hat=pc/(pc+pd);

w=(2*1.96**2)/(totobs*(pc+pd));
low_ci_w=((w+2*c_hat)/(2*(1+w)))-(sqrt((w**2+4*w*c_hat*(1-
c_hat))/(2*(1+w))));
upper_ci_w=((w+2*c_hat)/(2*(1+w)))+(sqrt((w**2+4*w*c_hat*(1-
c_hat))/(2*(1+w))));
run; &lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Dec 2016 18:10:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Calculating-Concordance-C-index-for-cox-models/m-p/33664#M19969</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2016-12-14T18:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Concordance (C-index) for cox models</title>
      <link>https://community.jmp.com/t5/Discussions/Calculating-Concordance-C-index-for-cox-models/m-p/33722#M20007</link>
      <description>&lt;P&gt;Here is my review of the SAS code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//This step does a cartesian join of the evtset and obs data tables,
// but eliminates any rows where the column idn_j=idn
// To do this in JMP would be a 2 step process.  Use 
//  Tables==&amp;gt;Join
// and specify to perform a Cartesian Join, then find all rows in 
// the new data table where idn_j==idn and delete them
proc sql;
 create table allset as
 select idn_j, y_j, x_j, idn as idn_i, surv as y_i, combdays as x_i
 from evtset, obs
 where idn_j&amp;lt;&amp;gt;idn;
quit;

// This step just creates a new column called "concord"
// SAS has to create a new table to do this, where JMP could
// just add it to the allset data table from the join step
data concord;
 set allset;
 if (x_i&amp;lt;x_j and y_i&amp;gt;y_j) or (x_i&amp;gt;x_j and y_i&amp;lt;y_j) then concord=1;
 else concord=0;
run; 

// This step simply creates macro variables for the number of rows
// that have been set to a concord value of 1 and 0 and a third 
// variable as to the number of total rows
// JMP would just do this with 3 statements
// ch=N rows(allset&amp;lt;&amp;lt;get rows where(concord==1));
// dh=N Rows(allset)-ch;
// uspairs=N Rows(allset);
data _null_;
 set concord end=eof;
 retain nch ndh;
 if _N_=1 then do;
  nch=0;
  ndh=0;
 end;
 if concord=1 then nch+1;
 if concord=0 then ndh+1;
 if eof=1 then do;
  call symput('ch',trim(left(nch)));
  call symput('dh',trim(left(ndh)));
  call symput('uspairs',trim(left(_n_)));
 end; 
run;

// This step references the original data table "sample" which
// was the input table to the phreg procedure that was run on it.
// This step simply gets the numer of rows from that table
// JMP code would simply be
// totobs=nrows(sample);
data _null_;
 set sample end=eof;
 if eof=1 then call symput('totobs',trim(left(_n_)));
run;

// This simply writes out the calculated macro values
%put &amp;amp;ch &amp;amp;dh &amp;amp;uspairs &amp;amp;totobs;

// This step creates an output data table with one row with the columns
// being calculated starting with the macro variable values
data calculat;
 ch=input("&amp;amp;ch",12.0);
 dh=input("&amp;amp;dh",12.0);
 uspairs=input("&amp;amp;uspairs",12.0);
 totobs=input("&amp;amp;totobs",10.0);
 pc=ch/(totobs*(totobs-1));
 pd=dh/(totobs*(totobs-1));
 c_hat=pc/(pc+pd);

 w=(2*1.96**2)/(totobs*(pc+pd));
 low_ci_w=((w+2*c_hat)/(2*(1+w)))-(sqrt((w**2+4*w*c_hat*(1-c_hat))/(2*(1+w))));
 upper_ci_w=((w+2*c_hat)/(2*(1+w)))+(sqrt((w**2+4*w*c_hat*(1-c_hat))/(2*(1+w))));
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Dec 2016 15:37:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Calculating-Concordance-C-index-for-cox-models/m-p/33722#M20007</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2016-12-15T15:37:47Z</dc:date>
    </item>
  </channel>
</rss>

