<?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 create an output including row &amp;amp; total percentages from a 2 by 2 frequency table &amp;amp;amp in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-output-including-row-amp-total-percentages-from/m-p/303340#M64421</link>
    <description>&lt;P&gt;Can you post your data and the output.&lt;/P&gt;
&lt;P&gt;I think you can use SQL to get that row_pct , after using proc freq to get that Chisquare,&lt;/P&gt;
&lt;P&gt;you can combine them together into one table.&lt;/P&gt;</description>
    <pubDate>Sat, 08 Oct 2016 03:49:24 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-10-08T03:49:24Z</dc:date>
    <item>
      <title>How to create an output including row &amp; total percentages from a 2 by 2 frequency table &amp; Stats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-output-including-row-amp-total-percentages-from/m-p/303255#M64382</link>
      <description>&lt;P&gt;I have ran FREQ Procedure to get a 2 by 2 frequency table and Chi Square Statistics for 20 measures. I'd like to create an output to include only row percentages for each category and total percentages from the frequency table, and Pearson chi-square statistics together. Now I only generated an output for Chi Square Stats. Is there any functions I can use to get the final result like the table below? Thanks a lot in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;MEASURE_ID&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;_PCHI_&lt;/TD&gt;&lt;TD&gt;P_PCHI&lt;/TD&gt;&lt;TD&gt;CATEGORY_1_PCT_ROW&lt;/TD&gt;&lt;TD&gt;CATEGORY_2_PCT_ROW&lt;/TD&gt;&lt;TD&gt;TOTAL _PCT_ROW&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;75&lt;/TD&gt;&lt;TD&gt;0.698578&lt;/TD&gt;&lt;TD&gt;0.40326191&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;16255&lt;/TD&gt;&lt;TD&gt;0.020613&lt;/TD&gt;&lt;TD&gt;0.88583941&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;2400&lt;/TD&gt;&lt;TD&gt;2.289016&lt;/TD&gt;&lt;TD&gt;0.13029252&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;FREQ&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DATA&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; = DATASET;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;BY&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; MEASURE_ID;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;TABLE&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; ETHNICITY * COMP_IND/&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;CHISQ&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;OUTPUT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;OUT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;=ChiSqData_V1 &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;N&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;PCHI&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;WEIGHT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; COUNT;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;PRINT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DATA&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=ChiSqData_V1 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;noobs&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2016 18:58:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-output-including-row-amp-total-percentages-from/m-p/303255#M64382</guid>
      <dc:creator>Merto</dc:creator>
      <dc:date>2016-10-07T18:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an output including row &amp; total percentages from a 2 by 2 frequency table &amp;amp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-output-including-row-amp-total-percentages-from/m-p/303269#M64390</link>
      <description>&lt;P&gt;You may need to provide some example data with calculated percentages as you need them. I am not sure at the moment what CATEGORY_1_PCT_ROW is actually. OR as a very bare minimum provide what is included in the numerator and denominator for the percentages. You may well have to have more than one data set and combine them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can get the row and column percentages by using the OUT= option on the TABLES statement with OUTPCT. Depending on what you are doing OUTEXPECT to get the expected frequency used in chi-square calculations may be helpful.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2016 19:29:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-output-including-row-amp-total-percentages-from/m-p/303269#M64390</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-07T19:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an output including row &amp; total percentages from a 2 by 2 frequency table &amp;amp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-output-including-row-amp-total-percentages-from/m-p/303309#M64409</link>
      <description>&lt;P&gt;Thank you ballardw. I tried the OUT= option on the TABLES statement with OUTPCT, but it only gives me the row and column percentages, but not the total percentages.&amp;nbsp; For example, I would like to have the compliance rates (row percentages) of non_white (90.24%) and white (76.47%), and the total compliance rate (84%) according to the table below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question number 1&amp;nbsp;will be: how can I get the total percent (84%) as well?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;IMG title="pic1.PNG" alt="pic1.PNG" src="https://communities.sas.com/t5/image/serverpage/image-id/5209i384765C5EFC70758/image-size/medium?v=v2&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;&lt;P&gt;Question number 2 is: in order to put values in the format below, is there a pivot function in proc sql that allows me to transpose data?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;MEASURE_ID&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;_PCHI_&lt;/TD&gt;&lt;TD&gt;P_PCHI&lt;/TD&gt;&lt;TD&gt;NON_WHITE_PCT_ROW&lt;/TD&gt;&lt;TD&gt;WHITE_PCT_ROW&lt;/TD&gt;&lt;TD&gt;TOTAL _PCT_ROW&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;75&lt;/TD&gt;&lt;TD&gt;0.698578&lt;/TD&gt;&lt;TD&gt;0.40326191&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 07 Oct 2016 21:08:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-output-including-row-amp-total-percentages-from/m-p/303309#M64409</guid>
      <dc:creator>Merto</dc:creator>
      <dc:date>2016-10-07T21:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an output including row &amp; total percentages from a 2 by 2 frequency table &amp;amp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-output-including-row-amp-total-percentages-from/m-p/303340#M64421</link>
      <description>&lt;P&gt;Can you post your data and the output.&lt;/P&gt;
&lt;P&gt;I think you can use SQL to get that row_pct , after using proc freq to get that Chisquare,&lt;/P&gt;
&lt;P&gt;you can combine them together into one table.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2016 03:49:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-output-including-row-amp-total-percentages-from/m-p/303340#M64421</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-10-08T03:49:24Z</dc:date>
    </item>
  </channel>
</rss>

