<?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: Proc Tabulate/Report in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Report/m-p/94036#M26641</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you should firstly change the data structure . after that it would be easy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;Data one;
input reason : $ year $ cas pct ;
cards;
XYZ 2010 68 51.9084
Others 2010 63 48.0916
XYZ 2011 169 62.3616
Others 2011 102 37.63
XYZ 2012 88 56.0510
Others 2012 69 43.9494
;
run;
data two;
 set one;
 length rea $ 50;
 rea=catx('_',reason,'cas');value=cas;output;
 rea=catx('_',reason,'pct');value=pct;output;
 keep rea year value;
run;
proc tabulate data=two order=data;
class rea year;
var value;
table rea=' ' , year=' '*value=' '*sum=' ' ;
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;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Aug 2012 03:10:25 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2012-08-15T03:10:25Z</dc:date>
    <item>
      <title>Proc Tabulate/Report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Report/m-p/94035#M26640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Help with Proc Tabulate/Report formatting output.&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Data one;&lt;BR /&gt;input reason : $ year $ cas pct ;&lt;BR /&gt;cards;&lt;BR /&gt;XYZ 2010 68 51.9084&lt;BR /&gt;Others 2010 63 48.0916&lt;BR /&gt;XYZ 2011 169 62.3616&lt;BR /&gt;Others 2011 102 37.63&lt;BR /&gt;XYZ 2012 88 56.0510&lt;BR /&gt;Others 2012 69 43.9494 &lt;BR /&gt;;&lt;BR /&gt;run;&lt;/DIV&gt;&lt;DIV&gt;How one create table like shown below with grid lines and exact column name either with proc report or proc tabulate?&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&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;&amp;nbsp;&amp;nbsp; 2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2012&lt;BR /&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;&amp;nbsp; --------------------------------&lt;BR /&gt;&amp;nbsp; XYZ_Cnt&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; 68&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 169&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 88&lt;BR /&gt;&amp;nbsp; XYZ_Pct&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; 51.9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 62.4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 56.0&lt;BR /&gt;&amp;nbsp; Others_Cnt&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 63&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 69&lt;BR /&gt;&amp;nbsp; Others_PCt&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 48.0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 37.6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 43.9&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #000080; font-family: Courier New;"&gt;My code shown below generates the output shown below, however, I would like to retain column name as shown above.&amp;nbsp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #575757; font-family: Courier New;"&gt;Proc &lt;STRONG&gt;tabulate&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt;=one &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New;"&gt;order&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Courier New;"&gt; Class reason year;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Courier New;"&gt; classlev reason /&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New;"&gt;style&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt;=&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New;"&gt;parent&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt;&amp;gt;[foreground=black];&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Courier New;"&gt; Var cas pct;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;table reason=&lt;SPAN style="color: #800080; font-family: Courier New;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt;*(cas=&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: Courier New;"&gt;'Xyz Count'&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New;"&gt;f&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: Courier New;"&gt;comma5.&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt; pct=&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: Courier New;"&gt;'Other Pct'&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New;"&gt;f&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt;=&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-family: Courier New;"&gt;8.1&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New;"&gt;), year=&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: Courier New;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt; / &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New;"&gt;row&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New;"&gt;float&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt;; &lt;/SPAN&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Courier New;"&gt;Key Label &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: Courier New;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG style=": ; color: #000080; font-family: Courier New;"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Courier New;"&gt;Output from above code:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;TABLE cellpadding="5" cellspacing="0" class="table" frame="box" rules="all" summary="Procedure Tabulate: Table 1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH class="l t rowheader" rowspan="2" scope="rowgroup" style="color: #000000;"&gt;XYZ&lt;/TH&gt;&lt;TH class="l t rowheader" scope="row"&gt;Xyz Count&lt;/TH&gt;&lt;TD class="r b data"&gt;68&lt;/TD&gt;&lt;TD class="r b data"&gt;169&lt;/TD&gt;&lt;TD class="r b data"&gt;88&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="l t rowheader" scope="row"&gt;Other Pct&lt;/TH&gt;&lt;TD class="r b data"&gt;51.9&lt;/TD&gt;&lt;TD class="r b data"&gt;62.4&lt;/TD&gt;&lt;TD class="r b data"&gt;56.1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="l t rowheader" rowspan="2" scope="rowgroup" style="color: #000000;"&gt;Others &lt;/TH&gt;&lt;TH class="l t rowheader" scope="row"&gt;Xyz Count&lt;/TH&gt;&lt;TD class="r b data"&gt;63&lt;/TD&gt;&lt;TD class="r b data"&gt;102&lt;/TD&gt;&lt;TD class="r b data"&gt;69&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="l t rowheader" scope="row"&gt;Other Pct&lt;/TH&gt;&lt;TD class="r b data"&gt;48.1&lt;/TD&gt;&lt;TD class="r b data"&gt;37.6&lt;/TD&gt;&lt;TD class="r b data"&gt;43.9&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2012 23:44:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Report/m-p/94035#M26640</guid>
      <dc:creator>GPatel</dc:creator>
      <dc:date>2012-08-14T23:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate/Report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Report/m-p/94036#M26641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you should firstly change the data structure . after that it would be easy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;Data one;
input reason : $ year $ cas pct ;
cards;
XYZ 2010 68 51.9084
Others 2010 63 48.0916
XYZ 2011 169 62.3616
Others 2011 102 37.63
XYZ 2012 88 56.0510
Others 2012 69 43.9494
;
run;
data two;
 set one;
 length rea $ 50;
 rea=catx('_',reason,'cas');value=cas;output;
 rea=catx('_',reason,'pct');value=pct;output;
 keep rea year value;
run;
proc tabulate data=two order=data;
class rea year;
var value;
table rea=' ' , year=' '*value=' '*sum=' ' ;
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;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2012 03:10:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Report/m-p/94036#M26641</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-08-15T03:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate/Report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Report/m-p/94037#M26642</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; You say you want gridlines and you are using some ODS style= overrides in your syntax, but I do not see any ODS statements in your posted code. What is your destination of interest? HTML, RTF, PDF, SASReport (inside Enterprise Guide), CSV or ????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; That would be good information to know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2012 04:35:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Report/m-p/94037#M26642</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-08-15T04:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate/Report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Report/m-p/94038#M26643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I got it worked somehow , but not sure....let me know your openion plz.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data one;&lt;/P&gt;&lt;P&gt;input reason : $ year $ cas pct;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;XYZ 2010 68 51.9084&lt;/P&gt;&lt;P&gt;Others 2010 63 48.0916&lt;/P&gt;&lt;P&gt;XYZ 2011 169 62.3616&lt;/P&gt;&lt;P&gt;Others 2011 102 37.63&lt;/P&gt;&lt;P&gt;XYZ 2012 88 56.0510&lt;/P&gt;&lt;P&gt;Others 2012 69 43.9494&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data two;&lt;/P&gt;&lt;P&gt;set one;&lt;/P&gt;&lt;P&gt;rea=catx('_',reason,'cas');value=cas;output;&lt;/P&gt;&lt;P&gt;rea=catx('_',reason,'pct');value=pct;output;&lt;/P&gt;&lt;P&gt;keep rea year value;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=two;&lt;/P&gt;&lt;P&gt;by rea year;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc tanspose data=two out=three(drop=_Name_);&lt;/P&gt;&lt;P&gt;id year;&lt;/P&gt;&lt;P&gt;by rea;&lt;/P&gt;&lt;P&gt;var value;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2012 10:22:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Report/m-p/94038#M26643</guid>
      <dc:creator>LHV</dc:creator>
      <dc:date>2012-08-15T10:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate/Report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Report/m-p/94039#M26644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Dear Cynthia, Ksharp, and LHV&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Your prompt and proposed soultion worked great.&amp;nbsp; Appreciate your time and interest.&amp;nbsp; I will use ODS style statements to display grids.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Girish Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2012 13:06:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Report/m-p/94039#M26644</guid>
      <dc:creator>GPatel</dc:creator>
      <dc:date>2012-08-15T13:06:37Z</dc:date>
    </item>
  </channel>
</rss>

