<?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: Stack Crosstabulation frequency tables into a single table in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Stack-Crosstabulation-frequency-tables-into-a-single-table-in/m-p/899559#M355555</link>
    <description>&lt;P&gt;I would suggest Proc Tabulate as well but provide a warning related to missing values on variables used for CLASS role: default behavior is that any class variable that is missing will exclude the entire observation from the table(s). There are some ways around this depending but need to see example data and the expected result to see if possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 22 Oct 2023 08:27:03 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-10-22T08:27:03Z</dc:date>
    <item>
      <title>Stack Crosstabulation frequency tables into a single table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stack-Crosstabulation-frequency-tables-into-a-single-table-in/m-p/899548#M355552</link>
      <description>&lt;P&gt;Hello!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am having trouble with stacking cross-tabulations from proc freq output for multiple variables across the same grouping variable. I want a table like the following:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TD width="68.4453px" height="30px"&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="77px" height="30px"&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD colspan="3" width="311px" height="30px"&gt;
&lt;P&gt;&lt;STRONG&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Test&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="68.4453px" height="30px"&gt;
&lt;P&gt;&lt;STRONG&gt;variable&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="77px" height="30px"&gt;
&lt;P&gt;&lt;STRONG&gt;Category&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="110px" height="30px"&gt;
&lt;P&gt;&lt;STRONG&gt;Arm_1&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98px" height="30px"&gt;
&lt;P&gt;&lt;STRONG&gt;Arm_2&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103px" height="30px"&gt;
&lt;P&gt;&lt;STRONG&gt;Total&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="68.4453px" height="30px"&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="77px" height="30px"&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="110px" height="30px"&gt;
&lt;P&gt;&lt;STRONG&gt;N=&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98px" height="30px"&gt;
&lt;P&gt;&lt;STRONG&gt;N=&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103px" height="30px"&gt;
&lt;P&gt;&lt;STRONG&gt;N=&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="68.4453px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="77px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="110px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="68.4453px" height="30px"&gt;
&lt;P&gt;sex&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="77px" height="30px"&gt;
&lt;P&gt;Female&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="110px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="68.4453px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="77px" height="30px"&gt;
&lt;P&gt;Male&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="110px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="68.4453px" height="30px"&gt;race&lt;/TD&gt;
&lt;TD width="77px" height="30px"&gt;
&lt;P&gt;Black&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="110px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="68.4453px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="77px" height="30px"&gt;
&lt;P&gt;white&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="110px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="68.4453px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="77px" height="30px"&gt;
&lt;P&gt;Hispanic&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="110px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="98px" height="30px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103px" height="30px"&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;I would like to essentially stack the PROC FREQ output for the sex*arm and race*arm cross tabulations into a single table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried using&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods table CrossTabFreqs=freqout;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But that hasn't given me exactly what I wanted. I have been using the sashelp.class dataset to try to work through the setup with the age*sex and height * sex crosstabs, but was not able to achieve the format above.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help is greatly appreciated. Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Oct 2023 01:21:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stack-Crosstabulation-frequency-tables-into-a-single-table-in/m-p/899548#M355552</guid>
      <dc:creator>awardell</dc:creator>
      <dc:date>2023-10-22T01:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: Stack Crosstabulation frequency tables into a single table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stack-Crosstabulation-frequency-tables-into-a-single-table-in/m-p/899550#M355553</link>
      <description>&lt;P&gt;If I understand right then below should get you close to the layout you're after.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=sashelp.cars(obs=10);
  class make type origin;
  keylabel n='N=' all='Total';
  table make type, (origin all)*n;
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Oct 2023 02:16:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stack-Crosstabulation-frequency-tables-into-a-single-table-in/m-p/899550#M355553</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-10-22T02:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: Stack Crosstabulation frequency tables into a single table in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stack-Crosstabulation-frequency-tables-into-a-single-table-in/m-p/899559#M355555</link>
      <description>&lt;P&gt;I would suggest Proc Tabulate as well but provide a warning related to missing values on variables used for CLASS role: default behavior is that any class variable that is missing will exclude the entire observation from the table(s). There are some ways around this depending but need to see example data and the expected result to see if possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Oct 2023 08:27:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stack-Crosstabulation-frequency-tables-into-a-single-table-in/m-p/899559#M355555</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-10-22T08:27:03Z</dc:date>
    </item>
  </channel>
</rss>

