<?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 output results as a fraction in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/output-results-as-a-fraction/m-p/397909#M278351</link>
    <description>&lt;P&gt;I am tasked with outputting results for a monetary amount in a fraction format: numerator/denominator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If my denominator is my total sample and my numerator is flag=1, my output needs to look like the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;total monetary amount when flag=1/total monetary amount for total sample&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure where to begin. Any ideas would be appreciated!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Sep 2017 19:42:44 GMT</pubDate>
    <dc:creator>LOLO</dc:creator>
    <dc:date>2017-09-21T19:42:44Z</dc:date>
    <item>
      <title>output results as a fraction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-results-as-a-fraction/m-p/397909#M278351</link>
      <description>&lt;P&gt;I am tasked with outputting results for a monetary amount in a fraction format: numerator/denominator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If my denominator is my total sample and my numerator is flag=1, my output needs to look like the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;total monetary amount when flag=1/total monetary amount for total sample&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure where to begin. Any ideas would be appreciated!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 19:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-results-as-a-fraction/m-p/397909#M278351</guid>
      <dc:creator>LOLO</dc:creator>
      <dc:date>2017-09-21T19:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: output results as a fraction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-results-as-a-fraction/m-p/397912#M278352</link>
      <description>&lt;P&gt;You can use the formats WORDF. or FRACT.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 19:48:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-results-as-a-fraction/m-p/397912#M278352</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-09-21T19:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: output results as a fraction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-results-as-a-fraction/m-p/397913#M278353</link>
      <description>&lt;P&gt;And if you can't figure it out using the formats, show some example data and what you want to see.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 20:05:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-results-as-a-fraction/m-p/397913#M278353</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-21T20:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: output results as a fraction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-results-as-a-fraction/m-p/397917#M278354</link>
      <description>&lt;P&gt;Thank you! ok, this is an example of the data and what I would like to see as the result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="192" style="width: 144pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL width="64" style="width: 48pt;" span="3" /&gt;&lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="64" height="19" style="border: 0px black; border-image: none; width: 48pt; height: 14.4pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;data:&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px black; border-image: none; width: 48pt; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" style="border: 0px black; border-image: none; height: 14.4pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;type&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;cost&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;flag&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" style="border: 0px black; border-image: none; height: 14.4pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;a&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;20&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" style="border: 0px black; border-image: none; height: 14.4pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;a&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;30&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;0&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" style="border: 0px black; border-image: none; height: 14.4pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;a&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;40&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;0&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" style="border: 0px black; border-image: none; height: 14.4pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;b&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;10&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" style="border: 0px black; border-image: none; height: 14.4pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;b&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;15&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" style="border: 0px black; border-image: none; height: 14.4pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;b&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;70&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;0&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" style="border: 0px black; border-image: none; height: 14.4pt; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" style="border: 0px black; border-image: none; height: 14.4pt; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" style="border: 0px black; border-image: none; height: 14.4pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;results:&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" style="border: 0px black; border-image: none; height: 14.4pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;a&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;20/90&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" style="border: 0px black; border-image: none; height: 14.4pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;b&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;25/95&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px black; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Thu, 21 Sep 2017 20:17:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-results-as-a-fraction/m-p/397917#M278354</guid>
      <dc:creator>LOLO</dc:creator>
      <dc:date>2017-09-21T20:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: output results as a fraction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-results-as-a-fraction/m-p/397923#M278355</link>
      <description>&lt;P&gt;PROC SUMMARY will provide you with the SUM in each value of TYPE. It can also sum the flagged values by each value of TYPE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can merge the results of the two PROC SUMMARY, and produce the output 20/90. You wouldn't even need a FORMAT, you can do it in a DATA step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a general rule, you would be wise to show your data in the original problem statement instead of providing later in the thread.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 20:35:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-results-as-a-fraction/m-p/397923#M278355</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-09-21T20:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: output results as a fraction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/output-results-as-a-fraction/m-p/397928#M278356</link>
      <description>&lt;P&gt;Here's an example that uses SQL&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input type $ cost flag;
cards;
a	20	1
a	30	0
a	40	0
b	10	1
b	15	1
b	70	0
;
run;

proc sql;
create table want as
select type, sum(cost*flag) as numerator, sum(cost) as denominator, 
    CALCULATED NUMERATOR/ CALCULATED DENOMINATOR AS FRAC FORMAT=FRACT.,
    CATX("/", put(calculated numerator, 8.), put(calculated denominator, 8.)) as frac_text
from have
group by type;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Sep 2017 20:49:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/output-results-as-a-fraction/m-p/397928#M278356</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-21T20:49:52Z</dc:date>
    </item>
  </channel>
</rss>

