<?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 Just inherited a Proc tabulate program... in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Just-inherited-a-Proc-tabulate-program/m-p/16327#M2963</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hello-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I recently inherited a program that uses Proc tabulate. I'm not familiar with this proc and I was asked to modify the way the table looks. I have to move the count and % values so they are colums next to each other . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table needs to look something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" class="jiveNoBorder" style="width: 257px; border-color: #000000; border-style: solid; border-width: 0px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="13" width="34"&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD class="xl24" colspan="2" width="78"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Yes&lt;/TD&gt;&lt;TD class="xl24" colspan="2" width="67"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; No &lt;/TD&gt;&lt;TD class="xl24" colspan="2" width="78"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Total &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="13"&gt;Unit&lt;/TD&gt;&lt;TD class="xl24"&gt;Count&lt;/TD&gt;&lt;TD class="xl24"&gt;&amp;nbsp;&amp;nbsp; %&lt;/TD&gt;&lt;TD class="xl24"&gt;Count&lt;/TD&gt;&lt;TD class="xl24"&gt;&amp;nbsp; %&lt;/TD&gt;&lt;TD class="xl24"&gt;Count&lt;/TD&gt;&lt;TD class="xl24"&gt;&amp;nbsp;&amp;nbsp; %&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="13"&gt;Unit1&lt;/TD&gt;&lt;TD class="xl24"&gt;&amp;nbsp;&amp;nbsp; 2&lt;/TD&gt;&lt;TD class="xl25"&gt;22.2%&lt;/TD&gt;&lt;TD align="right"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl26"&gt;50%&lt;/TD&gt;&lt;TD align="right"&gt;7&lt;/TD&gt;&lt;TD align="right" class="xl27"&gt;36.8%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="13"&gt;Unit2&lt;/TD&gt;&lt;TD class="xl24"&gt;&amp;nbsp;&amp;nbsp; 3&lt;/TD&gt;&lt;TD class="xl25"&gt;33.3%&lt;/TD&gt;&lt;TD align="right"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl26"&gt;50%&lt;/TD&gt;&lt;TD align="right"&gt;8&lt;/TD&gt;&lt;TD align="right" class="xl27"&gt;42.1%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="13"&gt;Total &lt;/TD&gt;&lt;TD class="xl24"&gt;&amp;nbsp;&amp;nbsp; 9&lt;/TD&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD align="right"&gt;10&lt;/TD&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD align="right"&gt;19&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently, the %'s fall under the Unit counts. I've tried moving things around but can't seem to get the right result. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what I have right now:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have any thoughts? &lt;/P&gt;&lt;P&gt;proc tabulate data=have&lt;/P&gt;&lt;P&gt; style=font_size=8pt};&lt;/P&gt;&lt;P&gt;class&amp;nbsp; quest unit answer&amp;nbsp; /&lt;/P&gt;&lt;P&gt;style={ font_size=9pt};&lt;/P&gt;&lt;P&gt;classlev question unit answer /&lt;/P&gt;&lt;P&gt;style={font_size=9pt};&lt;/P&gt;&lt;P&gt; tables quest=' ',&lt;/P&gt;&lt;P&gt;unit=' '*(n pagepctn*f=pctfmt.) all*(npagepctn*f=pctfmt.),&lt;/P&gt;&lt;P&gt; answer =' 'all&amp;nbsp; &lt;/P&gt;&lt;P&gt;/ row=float&lt;/P&gt;&lt;P&gt;box={label='Number^{newline 1}Overall^_%' style={ =9pt}};&lt;/P&gt;&lt;P&gt; keylabelall='Total'&lt;/P&gt;&lt;P&gt; n=' '&lt;/P&gt;&lt;P&gt;pagepctn=' ';&lt;/P&gt;&lt;P&gt;keyword all n pagepctn/&lt;/P&gt;&lt;P&gt;style={ font_size=8pt};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any feedback would be very helpful!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Feb 2012 01:27:09 GMT</pubDate>
    <dc:creator>JennyB</dc:creator>
    <dc:date>2012-02-28T01:27:09Z</dc:date>
    <item>
      <title>Just inherited a Proc tabulate program...</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Just-inherited-a-Proc-tabulate-program/m-p/16327#M2963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hello-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I recently inherited a program that uses Proc tabulate. I'm not familiar with this proc and I was asked to modify the way the table looks. I have to move the count and % values so they are colums next to each other . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table needs to look something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" class="jiveNoBorder" style="width: 257px; border-color: #000000; border-style: solid; border-width: 0px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="13" width="34"&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD class="xl24" colspan="2" width="78"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Yes&lt;/TD&gt;&lt;TD class="xl24" colspan="2" width="67"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; No &lt;/TD&gt;&lt;TD class="xl24" colspan="2" width="78"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Total &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="13"&gt;Unit&lt;/TD&gt;&lt;TD class="xl24"&gt;Count&lt;/TD&gt;&lt;TD class="xl24"&gt;&amp;nbsp;&amp;nbsp; %&lt;/TD&gt;&lt;TD class="xl24"&gt;Count&lt;/TD&gt;&lt;TD class="xl24"&gt;&amp;nbsp; %&lt;/TD&gt;&lt;TD class="xl24"&gt;Count&lt;/TD&gt;&lt;TD class="xl24"&gt;&amp;nbsp;&amp;nbsp; %&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="13"&gt;Unit1&lt;/TD&gt;&lt;TD class="xl24"&gt;&amp;nbsp;&amp;nbsp; 2&lt;/TD&gt;&lt;TD class="xl25"&gt;22.2%&lt;/TD&gt;&lt;TD align="right"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl26"&gt;50%&lt;/TD&gt;&lt;TD align="right"&gt;7&lt;/TD&gt;&lt;TD align="right" class="xl27"&gt;36.8%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="13"&gt;Unit2&lt;/TD&gt;&lt;TD class="xl24"&gt;&amp;nbsp;&amp;nbsp; 3&lt;/TD&gt;&lt;TD class="xl25"&gt;33.3%&lt;/TD&gt;&lt;TD align="right"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl26"&gt;50%&lt;/TD&gt;&lt;TD align="right"&gt;8&lt;/TD&gt;&lt;TD align="right" class="xl27"&gt;42.1%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="13"&gt;Total &lt;/TD&gt;&lt;TD class="xl24"&gt;&amp;nbsp;&amp;nbsp; 9&lt;/TD&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD align="right"&gt;10&lt;/TD&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;TD align="right"&gt;19&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently, the %'s fall under the Unit counts. I've tried moving things around but can't seem to get the right result. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what I have right now:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have any thoughts? &lt;/P&gt;&lt;P&gt;proc tabulate data=have&lt;/P&gt;&lt;P&gt; style=font_size=8pt};&lt;/P&gt;&lt;P&gt;class&amp;nbsp; quest unit answer&amp;nbsp; /&lt;/P&gt;&lt;P&gt;style={ font_size=9pt};&lt;/P&gt;&lt;P&gt;classlev question unit answer /&lt;/P&gt;&lt;P&gt;style={font_size=9pt};&lt;/P&gt;&lt;P&gt; tables quest=' ',&lt;/P&gt;&lt;P&gt;unit=' '*(n pagepctn*f=pctfmt.) all*(npagepctn*f=pctfmt.),&lt;/P&gt;&lt;P&gt; answer =' 'all&amp;nbsp; &lt;/P&gt;&lt;P&gt;/ row=float&lt;/P&gt;&lt;P&gt;box={label='Number^{newline 1}Overall^_%' style={ =9pt}};&lt;/P&gt;&lt;P&gt; keylabelall='Total'&lt;/P&gt;&lt;P&gt; n=' '&lt;/P&gt;&lt;P&gt;pagepctn=' ';&lt;/P&gt;&lt;P&gt;keyword all n pagepctn/&lt;/P&gt;&lt;P&gt;style={ font_size=8pt};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any feedback would be very helpful!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 01:27:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Just-inherited-a-Proc-tabulate-program/m-p/16327#M2963</guid>
      <dc:creator>JennyB</dc:creator>
      <dc:date>2012-02-28T01:27:09Z</dc:date>
    </item>
    <item>
      <title>Just inherited a Proc tabulate program...</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Just-inherited-a-Proc-tabulate-program/m-p/16328#M2964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would help others on the forum if you also post a copy of your have dataset.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 01:32:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Just-inherited-a-Proc-tabulate-program/m-p/16328#M2964</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-28T01:32:30Z</dc:date>
    </item>
    <item>
      <title>Just inherited a Proc tabulate program...</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Just-inherited-a-Proc-tabulate-program/m-p/16329#M2965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok, the dataset looks something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;data have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;&amp;nbsp; infile datalines dlm=',' dsd;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;&amp;nbsp; input &lt;/SPAN&gt;&lt;SPAN style="font-family: Calibri;"&gt;unit &lt;SPAN style="font-family: Calibri;"&gt;$ &lt;/SPAN&gt;question answer&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;return;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;datalines;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;"Unit1",1,1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;"Unit1 ",1,0&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;"Unit1 ",1,1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;"Unit1 ",1,0&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;"Unit1 ",1,1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;" Unit2",1,1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;" Unit2",1,1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;" Unit2",1,0&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;" Unit2",1,1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;" Unit2",1,0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: 0.1pt; margin-bottom: 0.1pt;"&gt;&lt;SPAN style="font-family: Calibri;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also apply formats to "Question" and "Answer".&amp;nbsp; Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 01:48:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Just-inherited-a-Proc-tabulate-program/m-p/16329#M2965</guid>
      <dc:creator>JennyB</dc:creator>
      <dc:date>2012-02-28T01:48:40Z</dc:date>
    </item>
    <item>
      <title>Just inherited a Proc tabulate program...</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Just-inherited-a-Proc-tabulate-program/m-p/16330#M2966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it what you are looking for ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;proc format;
value x
 1 = 'Yes'
 0 = 'No'
 ;
picture p
 low-high='0099%';
run;
data have;
&amp;nbsp; infile datalines dlm=',' dsd;
&amp;nbsp; input unit $ question answer;
&amp;nbsp; format answer x.;
datalines;
"Unit1",1,1
"Unit1 ",1,0
"Unit1 ",1,1
"Unit1 ",1,0
"Unit1 ",1,1
" Unit2",1,1
" Unit2",1,1
" Unit2",1,0
" Unit2",1,1
" Unit2",1,0
;
run;


proc tabulate data=have;
class unit answer;
table unit all,n='Count'*f=best8.*(answer='' all='Total') pctn='%'*f=p.*(answer='' all='Total') ;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 03:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Just-inherited-a-Proc-tabulate-program/m-p/16330#M2966</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-02-28T03:26:07Z</dc:date>
    </item>
    <item>
      <title>Just inherited a Proc tabulate program...</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Just-inherited-a-Proc-tabulate-program/m-p/16331#M2967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. I will try this out and let you know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 03:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Just-inherited-a-Proc-tabulate-program/m-p/16331#M2967</guid>
      <dc:creator>JennyB</dc:creator>
      <dc:date>2012-02-28T03:45:34Z</dc:date>
    </item>
  </channel>
</rss>

