<?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 Proc logistic, how to get the observations with ties? in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257225#M13589</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I built a logistic model and the number of ties are about 24%. How can I identify the observations which have ties, so that I can analyse them?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Mar 2016 07:49:14 GMT</pubDate>
    <dc:creator>munitech4u</dc:creator>
    <dc:date>2016-03-17T07:49:14Z</dc:date>
    <item>
      <title>Proc logistic, how to get the observations with ties?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257225#M13589</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I built a logistic model and the number of ties are about 24%. How can I identify the observations which have ties, so that I can analyse them?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2016 07:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257225#M13589</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2016-03-17T07:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc logistic, how to get the observations with ties?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257242#M13590</link>
      <description>&lt;P&gt;How do you define this TIES ? the obs have the same value in all the variables ?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2016 09:33:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257242#M13590</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-03-17T09:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Proc logistic, how to get the observations with ties?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257251#M13594</link>
      <description>No, I am talking about the section of logistic model, which tells about, concordant, dis-concordant and ties. Which are calculated from pairs of scored probabilities of target 1 and 0.</description>
      <pubDate>Thu, 17 Mar 2016 10:58:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257251#M13594</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2016-03-17T10:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Proc logistic, how to get the observations with ties?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257258#M13599</link>
      <description>&lt;OL&gt;
&lt;LI&gt;Get the scored data set - with predicted probabilities. Look at output statement.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Run a proc freq to generate Ctable&lt;/LI&gt;
&lt;LI&gt;Extract ties...&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Thu, 17 Mar 2016 11:32:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257258#M13599</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-17T11:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Proc logistic, how to get the observations with ties?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257264#M13600</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/41912"&gt;@munitech4u﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's take dataset REMISSION from the &lt;A href="http://support.sas.com/documentation/cdl//en/statug/68162/HTML/default/viewer.htm#statug_logistic_examples01.htm" target="_blank"&gt;PROC LOGISTIC documentation&lt;/A&gt; as a basis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Add an ID to identify observations */
data Remission;
set Remission;
id=_n_;
run; /* 27 obs. */

/* Run an arbitrary logistic regression, 
   write predicted probabilities to dataset PRED */
proc logistic data=Remission;
   model remiss(event='1')=li;
   output out=pred p=p;
run;

/* Create dataset TIES with "tied" pairs of IDs */
proc sql;
create table ties as
select a.id as id1, b.id as id2
from pred a, pred b
where a.id&amp;lt;b.id &amp;amp; a.remiss ne b.remiss &amp;amp; a.p=b.p;
quit; /* 5 obs. */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, you could create a dataset with all relevant pairs:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create dataset PAIRS with all pairs of IDs considered in output table
   "Association of Predicted Probabilities and Observed Responses" */
proc sql;
create table pairs as
select a.id as id1, b.id as id2, a.p as p1, b.p as p2, a.remiss as r1, b.remiss as r2,
       case when r1=1 &amp;amp; r2=0 &amp;amp; p1&amp;gt;p2 | r1=0 &amp;amp; r2=1 &amp;amp; p1&amp;lt;p2 then 'Concordant'
            when r1=1 &amp;amp; r2=0 &amp;amp; p1&amp;lt;p2 | r1=0 &amp;amp; r2=1 &amp;amp; p1&amp;gt;p2 then 'Discordant'
            else 'Tied' end as assoc
from pred a, pred b
where a.id&amp;lt;b.id &amp;amp; a.remiss ne b.remiss;
quit; /* 162 obs. */

proc freq data=pairs;
tables assoc;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;                                       Cumulative    Cumulative
assoc         Frequency     Percent     Frequency      Percent
---------------------------------------------------------------
Concordant         136       83.95           136        83.95
Discordant          21       12.96           157        96.91
Tied                 5        3.09           162       100.00&lt;/PRE&gt;
&lt;P&gt;This corresponds to table "Association of Predicted Probabilities and Observed Responses" in&amp;nbsp;Output 72.1.2 (see link above).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(Edit: just improved layout)&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2016 12:37:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257264#M13600</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-03-17T12:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: Proc logistic, how to get the observations with ties?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257272#M13602</link>
      <description>Thanks, but do you recommend running it on a dataset as large as 4 million?</description>
      <pubDate>Thu, 17 Mar 2016 13:09:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257272#M13602</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2016-03-17T13:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: Proc logistic, how to get the observations with ties?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257273#M13603</link>
      <description>proc freq to run ctable?, Can you please explain that?</description>
      <pubDate>Thu, 17 Mar 2016 13:10:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257273#M13603</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2016-03-17T13:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: Proc logistic, how to get the observations with ties?</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257292#M13604</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/41912"&gt;@munitech4u&lt;/a&gt; wrote:&lt;BR /&gt;Thanks, but do you recommend running it on a dataset as large as 4 million?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No, given this new information I would choose a different approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* "Blow up" the test dataset and add an ID to identify observations */
data Remission;
set Remission;
do i=1 to 148149;
  id=(_n_-1)*148149+i;
  output;
end;
drop i;
run; /* 4000023 obs. */

/* Run an arbitrary logistic regression, 
   write predicted probabilities to dataset PRED */
proc logistic data=Remission;
model remiss(event='1')=li;
output out=pred p=p;
run;

/* Select "tied" observations */
proc sql;
create table tied_obs(drop=_level_) as
select *
from pred
group by p
having count(distinct remiss)&amp;gt;1;
quit; /* 1185192 obs. */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This has the additional advantage that you have the other variables from dataset PRED in dataset TIED_OBS, so you can&amp;nbsp;start your analysis immediately.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: Simplified HAVING condition:&amp;nbsp;&lt;FONT face="courier new,courier"&gt;count(*)&amp;gt;1&lt;/FONT&gt; was redundant.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2016 14:01:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-logistic-how-to-get-the-observations-with-ties/m-p/257292#M13604</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-03-17T14:01:04Z</dc:date>
    </item>
  </channel>
</rss>

