<?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: Proc freq output dataset  missing the totals for a 2*2 table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510473#M137376</link>
    <description>&lt;P&gt;The PROC SUMMARY approach does provide column totals (and row totals).&lt;/P&gt;</description>
    <pubDate>Mon, 05 Nov 2018 16:08:45 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-11-05T16:08:45Z</dc:date>
    <item>
      <title>Proc freq output dataset  missing the totals for a 2*2 table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510446#M137371</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am doing a simple 2*2 proc freq.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data= pop order=freq;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tables sex*severity /missing ;&lt;BR /&gt; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;i get an output wiht the totals&lt;/P&gt;
&lt;P&gt;Frequency| Severe | Attenuated| Undetermed | Total&lt;BR /&gt;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 1&lt;BR /&gt;MALE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 371&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 183&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 34&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 588&lt;BR /&gt;FEMALE&amp;nbsp; | 336&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 194&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 25&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 555&lt;BR /&gt;Total&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 707&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;378&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;59&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1144&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;But when I specify an output dataset and a noprint option:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data= pop noprint order=freq;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tables sex*severity /missing out=test(drop=percent) ;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the output dataset test does not have the cumulative total. I tried a few options but none work.&lt;/P&gt;
&lt;P&gt;Any idea what I need to specify to get the total to be added in the output dataset?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;
&lt;P&gt;KC&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 15:29:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510446#M137371</guid>
      <dc:creator>Kc2</dc:creator>
      <dc:date>2018-11-05T15:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc freq output dataset  missing the totals for a 2*2 table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510451#M137372</link>
      <description>&lt;P&gt;You could get this using ODS OUTPUT. If there is a continuous variable in the data set, then PROC SUMMARY works as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods output crosstabfreqs=freqs;
proc freq data=pop;
    tables sex*severity/missing;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 15:40:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510451#M137372</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-05T15:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Proc freq output dataset  missing the totals for a 2*2 table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510453#M137373</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3443"&gt;@Kc2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am doing a simple 2*2 proc freq.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data= pop order=freq;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tables sex*severity /missing ;&lt;BR /&gt; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;i get an output wiht the totals&lt;/P&gt;
&lt;P&gt;Frequency| Severe | Attenuated| Undetermed | Total&lt;BR /&gt;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 1&lt;BR /&gt;MALE&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 371&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 183&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 34&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 588&lt;BR /&gt;FEMALE&amp;nbsp; | 336&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 194&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 25&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| 555&lt;BR /&gt;Total&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 707&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;378&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;59&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1144&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;But when I specify an output dataset and a noprint option:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data= pop noprint order=freq;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tables sex*severity /missing out=test(drop=percent) ;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the output dataset test does not have the cumulative total. I tried a few options but none work.&lt;/P&gt;
&lt;P&gt;Any idea what I need to specify to get the total to be added in the output dataset?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;
&lt;P&gt;KC&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can try&lt;/P&gt;
&lt;PRE&gt;proc freq data= pop noprint order=freq;
       tables sex*severity /missing norow nocol nopercent ;
       ods output crasstabfreq=test;
run;&lt;/PRE&gt;
&lt;P&gt;Which will have the row and column totals but I suspect not in a form you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is dangerous to include "totals" inside a data set when not extremely well documented, ie. another variable such as the _TYPE_ variable in the ODS OUTPUT table that indicates whether the value is a cell, row, column or table total.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do you need the totals in the data set?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 15:42:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510453#M137373</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-05T15:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Proc freq output dataset  missing the totals for a 2*2 table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510454#M137374</link>
      <description>&lt;P&gt;you could try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set pop;
output;
sex='Total';
severity ='Total';
output;
run;


proc freq data= want order=freq;
       tables sex*severity /missing out=test(drop=percent) ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Nov 2018 15:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510454#M137374</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2018-11-05T15:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Proc freq output dataset  missing the totals for a 2*2 table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510472#M137375</link>
      <description>&lt;P&gt;I need to have the totals column so I am trying to do everything in one step..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;So far none of the solutions provided work so i will do calculated the total in a separate step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 16:06:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510472#M137375</guid>
      <dc:creator>Kc2</dc:creator>
      <dc:date>2018-11-05T16:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc freq output dataset  missing the totals for a 2*2 table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510473#M137376</link>
      <description>&lt;P&gt;The PROC SUMMARY approach does provide column totals (and row totals).&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 16:08:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510473#M137376</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-05T16:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: Proc freq output dataset  missing the totals for a 2*2 table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510474#M137377</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3443"&gt;@Kc2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I need to have the totals column so I am trying to do everything in one step..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;So far none of the solutions provided work so i will do calculated the total in a separate step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;WHY? Do "what everything in one step"?&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 05 Nov 2018 16:12:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510474#M137377</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-05T16:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proc freq output dataset  missing the totals for a 2*2 table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510489#M137382</link>
      <description>&lt;P&gt;for reporting purposes. to report the individual categorical count and the tonal by category.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 16:48:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510489#M137382</guid>
      <dc:creator>Kc2</dc:creator>
      <dc:date>2018-11-05T16:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: Proc freq output dataset  missing the totals for a 2*2 table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510501#M137388</link>
      <description>&lt;P&gt;The idea of doing everything in one step sometimes leads people to very complicated or unworkable code that takes hours to get right.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can run PROC SUMMARY to get the sums, and then PROC REPORT to make your nice report. You could also do it entirely in PROC REPORT.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 17:35:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510501#M137388</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-05T17:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Proc freq output dataset  missing the totals for a 2*2 table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510637#M137430</link>
      <description>&lt;P&gt;Proc tabulate if you don't like the default proc freq appearance is also an option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.class;
   class sex age;
   table sex='' all='Total',
         (age='' all='Total')*n=''
         /misstext=' ';
run;&lt;/PRE&gt;
&lt;P&gt;Proc tabulate also has lots of appearance modification possibilities.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 23:07:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-freq-output-dataset-missing-the-totals-for-a-2-2-table/m-p/510637#M137430</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-05T23:07:46Z</dc:date>
    </item>
  </channel>
</rss>

