<?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 How to use proc tabulate to create table with multiple different rows? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-proc-tabulate-to-create-table-with-multiple-different/m-p/215405#M53019</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; background-color: #ffffff;"&gt;I have a table looks like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; background-color: #ffffff;"&gt;And I want to use Proc tabulate to create a tabular report like this: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 15px; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="line-height: 1.5em;"&gt;What should be the correct way to do this?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 27 Jun 2015 11:14:47 GMT</pubDate>
    <dc:creator>TasteMyBiceps</dc:creator>
    <dc:date>2015-06-27T11:14:47Z</dc:date>
    <item>
      <title>How to use proc tabulate to create table with multiple different rows?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-proc-tabulate-to-create-table-with-multiple-different/m-p/215405#M53019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; background-color: #ffffff;"&gt;I have a table looks like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; background-color: #ffffff;"&gt;And I want to use Proc tabulate to create a tabular report like this: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1em; font-size: 15px; color: #222222; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="line-height: 1.5em;"&gt;What should be the correct way to do this?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2015 11:14:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-proc-tabulate-to-create-table-with-multiple-different/m-p/215405#M53019</guid>
      <dc:creator>TasteMyBiceps</dc:creator>
      <dc:date>2015-06-27T11:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use proc tabulate to create table with multiple different rows?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-proc-tabulate-to-create-table-with-multiple-different/m-p/215406#M53020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; I think your issue is defining too many of your variables as being a CLASS (category or grouping) usage, when it seems to me that GROUPX, RESPONDENT, CLASS_A, CLASS_B, and CLASS_C should all be ANALYSIS variables in a VAR statement, not a CLASS statement. Then your next issue is using the * (asterisk) operator, which nests or crosses items and instead, you want them to merely be "stacked" or concatenated -- for each variable (GROUPX, RESPONDENT, etc) to be a separate row in the report table.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; Something more like the code below, that produced this output:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="tabulate_table.png" class="jive-image" src="https://communities.sas.com/legacyfs/online/11024_tabulate_table.png" /&gt;&lt;/P&gt;&lt;P&gt;Cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;data my_data;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; infile datalines dlm=',' dsd;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; input resp_id $&amp;nbsp; groupx&amp;nbsp; respondent class_A class_B class_C;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; ** adjust these 3 so that can use simple PERCENT format (which multiplies by 100);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; class_A = class_A / 100;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; class_B = class_B / 100;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; class_C = class_C / 100;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;return;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;P001,5,10,100,.,.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;P002,4,13,61.53846,23.07692,15.38462&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;P003,5,13,38.46154,53.84615,7.692308&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;P004,7,20,60,25,15&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;ods html file='c:\temp\diff_tabulate.html' style=pearl;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;proc tabulate data=my_data f=comma6.0;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;class resp_id/ missing style=Header{background=white};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;var class_a class_b class_c respondent groupx / style=Header{background=white};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;table groupx&amp;nbsp;&amp;nbsp; respondent&amp;nbsp;&amp;nbsp; class_a*f=percent9.2&amp;nbsp;&amp;nbsp; class_b*f=percent9.2&amp;nbsp;&amp;nbsp; class_c*f=percent9.2,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resp_id / row=float misstext='-';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;title 'try me';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;keylabel sum=' ';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;label groupx = '# Group X'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; respondent = '# Respondent'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; class_a = '% Resp Class A'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; class_b = '% Resp Class B'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; class_c = '% Resp Class C';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;ods html close;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jun 2015 01:52:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-proc-tabulate-to-create-table-with-multiple-different/m-p/215406#M53020</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2015-06-28T01:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use proc tabulate to create table with multiple different rows?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-proc-tabulate-to-create-table-with-multiple-different/m-p/215407#M53021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for you help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 00:05:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-proc-tabulate-to-create-table-with-multiple-different/m-p/215407#M53021</guid>
      <dc:creator>TasteMyBiceps</dc:creator>
      <dc:date>2015-06-30T00:05:38Z</dc:date>
    </item>
  </channel>
</rss>

