<?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 stack multiple freq tables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-stack-multiple-freq-tables/m-p/625695#M184449</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks for the information!!&lt;/P&gt;
&lt;P&gt;I very much appreciate your help!&lt;/P&gt;</description>
    <pubDate>Tue, 18 Feb 2020 19:57:53 GMT</pubDate>
    <dc:creator>superbug</dc:creator>
    <dc:date>2020-02-18T19:57:53Z</dc:date>
    <item>
      <title>How to stack multiple freq tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-stack-multiple-freq-tables/m-p/625671#M184434</link>
      <description>&lt;P&gt;As in the attachment, I have multiple "pair_" variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used the following code to get freqency on the categories of each "pair_:" variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data=have;&lt;BR /&gt;table Pair_:;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the "&lt;STRONG&gt;Results Viewer&lt;/STRONG&gt;" I got many freq tables of each "Pair_:" variable.&lt;/P&gt;
&lt;P&gt;For example, "pair_1_2" looks like following&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Freq: One-Way Frequencies" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l b header" scope="col"&gt;Pair_1_2&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Frequency&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Percent&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Cumulative&lt;BR /&gt;Frequency&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Cumulative&lt;BR /&gt;Percent&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;different resp and both wrong&lt;/TH&gt;
&lt;TD class="r data"&gt;35&lt;/TD&gt;
&lt;TD class="r data"&gt;17.50&lt;/TD&gt;
&lt;TD class="r data"&gt;35&lt;/TD&gt;
&lt;TD class="r data"&gt;17.50&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;different resp and one of them&lt;/TH&gt;
&lt;TD class="r data"&gt;37&lt;/TD&gt;
&lt;TD class="r data"&gt;18.50&lt;/TD&gt;
&lt;TD class="r data"&gt;72&lt;/TD&gt;
&lt;TD class="r data"&gt;36.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;same resp and both correct&lt;/TH&gt;
&lt;TD class="r data"&gt;118&lt;/TD&gt;
&lt;TD class="r data"&gt;59.00&lt;/TD&gt;
&lt;TD class="r data"&gt;190&lt;/TD&gt;
&lt;TD class="r data"&gt;95.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;same resp and both wrong&lt;/TH&gt;
&lt;TD class="r data"&gt;10&lt;/TD&gt;
&lt;TD class="r data"&gt;5.00&lt;/TD&gt;
&lt;TD class="r data"&gt;200&lt;/TD&gt;
&lt;TD class="r data"&gt;100.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I want to stack all of the freq table into One table, then&amp;nbsp;&amp;nbsp;using the stacked freq table, I want to divided "frequency" by 149, and get a "new_pct" variable, the results I wanted will look like the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="582"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="140px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="168.8px"&gt;category&lt;/TD&gt;
&lt;TD width="65.6px"&gt;freq&lt;/TD&gt;
&lt;TD width="65.6px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="70.4px"&gt;pct_new&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="140px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="168.8px"&gt;different resp and both wrong&lt;/TD&gt;
&lt;TD width="65.6px"&gt;35&lt;/TD&gt;
&lt;TD width="65.6px"&gt;149&lt;/TD&gt;
&lt;TD width="70.4px"&gt;0.23&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="140px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="168.8px"&gt;different resp and one of them&lt;/TD&gt;
&lt;TD width="65.6px"&gt;37&lt;/TD&gt;
&lt;TD width="65.6px"&gt;149&lt;/TD&gt;
&lt;TD width="70.4px"&gt;0.25&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="140px"&gt;pair_1_2&lt;/TD&gt;
&lt;TD width="168.8px"&gt;same resp and both correct&lt;/TD&gt;
&lt;TD width="65.6px"&gt;118&lt;/TD&gt;
&lt;TD width="65.6px"&gt;149&lt;/TD&gt;
&lt;TD width="70.4px"&gt;0.79&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="140px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="168.8px"&gt;same resp and both wrong&lt;/TD&gt;
&lt;TD width="65.6px"&gt;10&lt;/TD&gt;
&lt;TD width="65.6px"&gt;149&lt;/TD&gt;
&lt;TD width="70.4px"&gt;0.07&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="140px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="168.8px"&gt;different resp and both wrong&lt;/TD&gt;
&lt;TD width="65.6px"&gt;42&lt;/TD&gt;
&lt;TD width="65.6px"&gt;149&lt;/TD&gt;
&lt;TD width="70.4px"&gt;0.28&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="140px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="168.8px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="65.6px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="65.6px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="70.4px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="140px"&gt;pari_1_3&lt;/TD&gt;
&lt;TD width="168.8px"&gt;different resp and one of them&lt;/TD&gt;
&lt;TD width="65.6px"&gt;34&lt;/TD&gt;
&lt;TD width="65.6px"&gt;149&lt;/TD&gt;
&lt;TD width="70.4px"&gt;0.23&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="140px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="168.8px"&gt;same resp and both correct&lt;/TD&gt;
&lt;TD width="65.6px"&gt;114&lt;/TD&gt;
&lt;TD width="65.6px"&gt;149&lt;/TD&gt;
&lt;TD width="70.4px"&gt;0.77&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="140px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="168.8px"&gt;same resp and both wrong&lt;/TD&gt;
&lt;TD width="65.6px"&gt;10&lt;/TD&gt;
&lt;TD width="65.6px"&gt;149&lt;/TD&gt;
&lt;TD width="70.4px"&gt;0.07&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What's the efficient SAS code to stack all freq tables and then get the&amp;nbsp; final wanted table ? Any help would be much appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 19:07:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-stack-multiple-freq-tables/m-p/625671#M184434</guid>
      <dc:creator>superbug</dc:creator>
      <dc:date>2020-02-18T19:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to stack multiple freq tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-stack-multiple-freq-tables/m-p/625688#M184446</link>
      <description>&lt;P&gt;Actually...disregard the previous message, you need this one, since you're only looking at one variable at a time. For some reason I thought you were looking at two. This is an example of exactly what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gist.github.com/statgeek/e0903d269d4a71316a4e" target="_blank"&gt;https://gist.github.com/statgeek/e0903d269d4a71316a4e&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 19:35:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-stack-multiple-freq-tables/m-p/625688#M184446</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-02-18T19:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to stack multiple freq tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-stack-multiple-freq-tables/m-p/625695#M184449</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks for the information!!&lt;/P&gt;
&lt;P&gt;I very much appreciate your help!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 19:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-stack-multiple-freq-tables/m-p/625695#M184449</guid>
      <dc:creator>superbug</dc:creator>
      <dc:date>2020-02-18T19:57:53Z</dc:date>
    </item>
  </channel>
</rss>

