<?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 Automate creation of ROC curves from contingency tables in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Automate-creation-of-ROC-curves-from-contingency-tables/m-p/185843#M6847</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Dear Community,&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;EM&gt;At the suggestion of Cynthia@sas, I am re-posting this question in this group.&amp;nbsp; (I originally posted it in SAS Macro Facility, Data Step and SAS Language Elements.)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I have a macro that successfully creates 2x2 contingency tables, one for each value of a variable X.&amp;nbsp; The contingency tables are created from PROC FREQ.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Now, I would like to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1) calculate the specificity and sensitivity from each table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;2) plot all pairs of sensitivity and 1-specificity to create an ROC curve (sensitivity vs. 1-specificity) for all values of X&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Is there a way to automate this in SAS?&amp;nbsp; I can't find a way to do so via searching on Google or SAS documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I envision the successful macro being able to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;a) extract the counts from each cell in each contingency table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;b) calculate sensitivity and 1-specificity for each contingency table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;c) plot sensitivity vs. 1-specificity&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;but I can't figure out how to do this.&amp;nbsp; (I'm sure that DO-loops and arrays are needed somehow.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Thus, right now, I am typing the counts by hand into Microsoft Excel and plotting the ROC curve there.&amp;nbsp; This worked initially when I only had to create 5 ROC curves, but I now need to produce 20, and I wish to automate this process.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Any help that you can provide would be much appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Eric&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Jan 2014 03:57:55 GMT</pubDate>
    <dc:creator>EricCai</dc:creator>
    <dc:date>2014-01-02T03:57:55Z</dc:date>
    <item>
      <title>Automate creation of ROC curves from contingency tables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Automate-creation-of-ROC-curves-from-contingency-tables/m-p/185843#M6847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Dear Community,&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;EM&gt;At the suggestion of Cynthia@sas, I am re-posting this question in this group.&amp;nbsp; (I originally posted it in SAS Macro Facility, Data Step and SAS Language Elements.)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I have a macro that successfully creates 2x2 contingency tables, one for each value of a variable X.&amp;nbsp; The contingency tables are created from PROC FREQ.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Now, I would like to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;1) calculate the specificity and sensitivity from each table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;2) plot all pairs of sensitivity and 1-specificity to create an ROC curve (sensitivity vs. 1-specificity) for all values of X&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Is there a way to automate this in SAS?&amp;nbsp; I can't find a way to do so via searching on Google or SAS documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I envision the successful macro being able to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;a) extract the counts from each cell in each contingency table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;b) calculate sensitivity and 1-specificity for each contingency table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;c) plot sensitivity vs. 1-specificity&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;but I can't figure out how to do this.&amp;nbsp; (I'm sure that DO-loops and arrays are needed somehow.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Thus, right now, I am typing the counts by hand into Microsoft Excel and plotting the ROC curve there.&amp;nbsp; This worked initially when I only had to create 5 ROC curves, but I now need to produce 20, and I wish to automate this process.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Any help that you can provide would be much appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Eric&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jan 2014 03:57:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Automate-creation-of-ROC-curves-from-contingency-tables/m-p/185843#M6847</guid>
      <dc:creator>EricCai</dc:creator>
      <dc:date>2014-01-02T03:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Automate creation of ROC curves from contingency tables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Automate-creation-of-ROC-curves-from-contingency-tables/m-p/185844#M6848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Eric,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go to Lex Jansen's wonderful website - &lt;A href="http://www.lexjansen.com/"&gt;www.lexjansen.com&lt;/A&gt;&amp;nbsp; and search for the SUGI paper "Constructing ROC Curves with the SAS System" by Andrew Stead.&amp;nbsp; The paper contains a nice macro for calculating and plotting ROC curves.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Renee&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jan 2014 15:40:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Automate-creation-of-ROC-curves-from-contingency-tables/m-p/185844#M6848</guid>
      <dc:creator>sunnyrj</dc:creator>
      <dc:date>2014-01-03T15:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: Automate creation of ROC curves from contingency tables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Automate-creation-of-ROC-curves-from-contingency-tables/m-p/185845#M6849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Renee,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the suggestion, and sorry for the late reply.&amp;nbsp; After much trying in SAS, I realized that it would be easier to plot the ROC curves in R, so I proceeded to do that successfully and smoothly.&amp;nbsp; There were many curves that I needed to draw, and I needed to do a lot of annotation and colour-coding, so I'm glad that I did it in R.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 May 2014 02:05:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Automate-creation-of-ROC-curves-from-contingency-tables/m-p/185845#M6849</guid>
      <dc:creator>EricCai</dc:creator>
      <dc:date>2014-05-04T02:05:19Z</dc:date>
    </item>
  </channel>
</rss>

