<?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: How to calculate ratio with PROC TABULATE? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-calculate-ratio-with-PROC-TABULATE/m-p/126883#M34806</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Tom:&lt;/P&gt;&lt;P&gt;&amp;nbsp; Your method is the only way with REPORT. The challenge with the List Report Wizard in EG is that you cannot do a COMPUTE block. So while it's good for getting the basic report structure down, the code in the COMPUTE block has to be added. Which means you have to export the REPORT code and add the COMPUTE block. (which means you have to understand the compute block).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; There is also a way to do this with TABULATE (using your data), but it requires using a special denominator definition -- so also needs code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc format;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; picture pct (round) low-high='009.99%';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc tabulate data=have;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; class year;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; var total errors;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; table year all,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; total errors errors*pctsum&amp;lt;total&amp;gt;*f=pct.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Jul 2013 22:28:02 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2013-07-04T22:28:02Z</dc:date>
    <item>
      <title>How to calculate ratio with PROC TABULATE?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-calculate-ratio-with-PROC-TABULATE/m-p/126880#M34803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is there any way to create a user-defined column either with "Summary Tables" Report in SAS Enterprise Guide or with SAS PROC TABULATE procedure?&lt;/P&gt;&lt;P&gt;I didn't find the solution so far.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I would like to get, is following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 272px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="text-align: center;" width="64"&gt; &lt;/TD&gt;&lt;TD class="xl63" style="border-left-style: none; text-align: center;" width="64"&gt;&lt;STRONG&gt;Total&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left-style: none; text-align: center;" width="64"&gt;&lt;STRONG&gt;Errors&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl66" style="border-left-style: none; text-align: center;" width="80"&gt;&lt;STRONG&gt;Ratio&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top-style: none; text-align: center;"&gt;&lt;STRONG&gt;Year&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none; text-align: center;"&gt;&lt;STRONG&gt;Sum&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-top-style: none; border-left-style: none; text-align: center;"&gt;&lt;STRONG&gt;Sum&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl66" style="border-top-style: none; border-left-style: none; text-align: center;"&gt;&lt;STRONG&gt;Errors/Total&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl64" height="20" style="border-top: none;"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;"&gt;1000&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;&lt;TD align="right"&gt;1,00%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;2011&lt;/TD&gt;&lt;TD align="right"&gt;3000&lt;/TD&gt;&lt;TD align="right"&gt;25&lt;/TD&gt;&lt;TD align="right"&gt;0,83%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" height="20"&gt;2012&lt;/TD&gt;&lt;TD align="right"&gt;2000&lt;/TD&gt;&lt;TD align="right"&gt;32&lt;/TD&gt;&lt;TD align="right"&gt;1,60%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;Total&lt;/TD&gt;&lt;TD align="right"&gt;6000&lt;/TD&gt;&lt;TD align="right"&gt;67&lt;/TD&gt;&lt;TD align="right"&gt;1,12%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two variables TOTAL and ERRORS, I am looking for an option in SAS EG to implement my column RATIO, that would show ratio values.&lt;/P&gt;&lt;P&gt;I tried the possibility to calculate this column in a data set, and then to implement it as a separate value, Works OK, apart from the TOTAL value for RATIO. (I do not want this value to be summarized. It should show the ratio between SUM(Errors) / SUM(Total))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for your ideas!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jul 2013 16:22:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-calculate-ratio-with-PROC-TABULATE/m-p/126880#M34803</guid>
      <dc:creator>Miron</dc:creator>
      <dc:date>2013-07-04T16:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate ratio with PROC TABULATE?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-calculate-ratio-with-PROC-TABULATE/m-p/126881#M34804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What does your input data look like.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jul 2013 17:52:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-calculate-ratio-with-PROC-TABULATE/m-p/126881#M34804</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-07-04T17:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate ratio with PROC TABULATE?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-calculate-ratio-with-PROC-TABULATE/m-p/126882#M34805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Easy enough to do with PROC REPORT. Not sure how to get EG to do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input year total errors;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;2010 1000 10&lt;/P&gt;&lt;P&gt;2011 3000 25&lt;/P&gt;&lt;P&gt;2012 2000 32&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;proc report nofs ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; column year total errors ratio ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; define year / order order=internal ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; define total / sum ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; define errors / sum ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; define ratio / computed format=percent8.2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; compute ratio ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ratio = errors.sum / total.sum ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rbreak after / ol summarize ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; total&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; errors&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ratio&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.00%&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.83%&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 32&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.60%&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&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;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&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; 6000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 67&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.12%&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jul 2013 18:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-calculate-ratio-with-PROC-TABULATE/m-p/126882#M34805</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-07-04T18:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate ratio with PROC TABULATE?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-calculate-ratio-with-PROC-TABULATE/m-p/126883#M34806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Tom:&lt;/P&gt;&lt;P&gt;&amp;nbsp; Your method is the only way with REPORT. The challenge with the List Report Wizard in EG is that you cannot do a COMPUTE block. So while it's good for getting the basic report structure down, the code in the COMPUTE block has to be added. Which means you have to export the REPORT code and add the COMPUTE block. (which means you have to understand the compute block).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; There is also a way to do this with TABULATE (using your data), but it requires using a special denominator definition -- so also needs code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc format;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; picture pct (round) low-high='009.99%';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc tabulate data=have;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; class year;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; var total errors;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; table year all,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; total errors errors*pctsum&amp;lt;total&amp;gt;*f=pct.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jul 2013 22:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-calculate-ratio-with-PROC-TABULATE/m-p/126883#M34806</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2013-07-04T22:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate ratio with PROC TABULATE?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-calculate-ratio-with-PROC-TABULATE/m-p/126884#M34807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Tom!&lt;/P&gt;&lt;P&gt;That's exactly what I was looking for! As Cynthia mentioned, you do not have the COMPUTE block option in EG, so I wrote a code instead!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jul 2013 09:51:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-calculate-ratio-with-PROC-TABULATE/m-p/126884#M34807</guid>
      <dc:creator>Miron</dc:creator>
      <dc:date>2013-07-05T09:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate ratio with PROC TABULATE?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-calculate-ratio-with-PROC-TABULATE/m-p/126885#M34808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Cynthia,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it is a very helpful solution as well. I ,personally, find the solution with PROC REPORT a bit strightforward.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you all for proposed solutions!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jul 2013 09:52:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-calculate-ratio-with-PROC-TABULATE/m-p/126885#M34808</guid>
      <dc:creator>Miron</dc:creator>
      <dc:date>2013-07-05T09:52:58Z</dc:date>
    </item>
  </channel>
</rss>

