<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate/m-p/865675#M341853</link>
    <description>&lt;P&gt;Some example data and what you expect the proc tabulate to show for that data would help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have that error because of this in your code:&lt;/P&gt;
&lt;PRE&gt; (sex="gender(count)"*&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;n&lt;/STRONG&gt;&lt;/FONT&gt;=" " all*&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;n&lt;/STRONG&gt;&lt;/FONT&gt;=" " sex ="gender(%)"*&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;pctn&lt;/STRONG&gt;&lt;/FONT&gt;=" " all*&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;pctn&lt;/STRONG&gt;&lt;/FONT&gt;=" ")&lt;FONT size="5" color="#800000"&gt;&lt;STRONG&gt; *&lt;/STRONG&gt;&lt;/FONT&gt;
(aval="Lab_Group Result"*&lt;FONT color="#008000"&gt;&lt;STRONG&gt;sum&lt;/STRONG&gt;&lt;/FONT&gt; aval="Lab_Group Result"*&lt;FONT color="#008000"&gt;&lt;STRONG&gt;pctn&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;Where the * shows a nesting attempt you have STATISTICS N and PCTN in blue above attempting to&amp;nbsp; nest with SUM and PCTN shown in green below them inside the same column. You cannot nest a statistic or cross a statistic with another. Which means that you can't have statistics on both sides of an asterisk (nest) or a comma (row/column intersection).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sometimes if you need complex tables you may need to do the summaries in other procedures and/or a data step and then use a different tool to prepare tables such as the Report Writing Interface in the data step that lets you place any value into cells of a table (caution: somewhat heavier programming involved)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Mar 2023 08:57:18 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-03-22T08:57:18Z</dc:date>
    <item>
      <title>proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate/m-p/865668#M341850</link>
      <description>&lt;DIV class=""&gt;Please, I need help with the code below.&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;I'm trying to create a table such that sex and aval are nested in the column, with n and pctn for sex, while for aval; sum and pct sum.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;proc tabulate data=treatment2;&lt;BR /&gt;var aval;&lt;BR /&gt;class trt sex;&lt;BR /&gt;table trt all, (sex="gender(count)"*n=" " all*n=" " sex ="gender(%)"*pctn=" " all*pctn=" ") *&lt;BR /&gt;(aval="Lab_Group Result"*sum aval="Lab_Group Result"*pctn);&lt;BR /&gt;run;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;When I ran this code it gave the following error;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;ERROR: There are multiple statistics associated with a single table cell in the following nesting : TRT * SEX * N * AVAL * Sum.&lt;/DIV&gt;&lt;DIV class=""&gt;ERROR: There are multiple statistics associated with a single table cell in the following nesting : TRT * SEX * N * AVAL * PctN. I'm using sas studio.&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;Thank you, anticipating replies.&lt;/DIV&gt;</description>
      <pubDate>Wed, 22 Mar 2023 07:10:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate/m-p/865668#M341850</guid>
      <dc:creator>PrinceAde</dc:creator>
      <dc:date>2023-03-22T07:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate/m-p/865675#M341853</link>
      <description>&lt;P&gt;Some example data and what you expect the proc tabulate to show for that data would help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have that error because of this in your code:&lt;/P&gt;
&lt;PRE&gt; (sex="gender(count)"*&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;n&lt;/STRONG&gt;&lt;/FONT&gt;=" " all*&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;n&lt;/STRONG&gt;&lt;/FONT&gt;=" " sex ="gender(%)"*&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;pctn&lt;/STRONG&gt;&lt;/FONT&gt;=" " all*&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;pctn&lt;/STRONG&gt;&lt;/FONT&gt;=" ")&lt;FONT size="5" color="#800000"&gt;&lt;STRONG&gt; *&lt;/STRONG&gt;&lt;/FONT&gt;
(aval="Lab_Group Result"*&lt;FONT color="#008000"&gt;&lt;STRONG&gt;sum&lt;/STRONG&gt;&lt;/FONT&gt; aval="Lab_Group Result"*&lt;FONT color="#008000"&gt;&lt;STRONG&gt;pctn&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;Where the * shows a nesting attempt you have STATISTICS N and PCTN in blue above attempting to&amp;nbsp; nest with SUM and PCTN shown in green below them inside the same column. You cannot nest a statistic or cross a statistic with another. Which means that you can't have statistics on both sides of an asterisk (nest) or a comma (row/column intersection).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sometimes if you need complex tables you may need to do the summaries in other procedures and/or a data step and then use a different tool to prepare tables such as the Report Writing Interface in the data step that lets you place any value into cells of a table (caution: somewhat heavier programming involved)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 08:57:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate/m-p/865675#M341853</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-03-22T08:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate/m-p/865711#M341868</link>
      <description>&lt;P&gt;I expect to have the sex(gender) and aval(lab_group result)to be nexted on the column, PS lab_group result = lgr, sum=S and pctn=P.&lt;/P&gt;&lt;P&gt;I expect the column to look like this;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;gender(count)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;gender(%)&lt;/P&gt;&lt;P&gt;F&amp;nbsp; &amp;nbsp; M&amp;nbsp; &amp;nbsp; &amp;nbsp;All&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;F&amp;nbsp; &amp;nbsp; &amp;nbsp; M&amp;nbsp; &amp;nbsp; &amp;nbsp;All&lt;/P&gt;&lt;P&gt;lgr&amp;nbsp; &amp;nbsp;lgr&amp;nbsp; &amp;nbsp;lgr&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lgr&amp;nbsp; &amp;nbsp; &amp;nbsp;lgr&amp;nbsp; &amp;nbsp;lgr&lt;/P&gt;&lt;P&gt;S&amp;nbsp; &amp;nbsp; &amp;nbsp; S&amp;nbsp; &amp;nbsp; S&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; P&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;P&amp;nbsp; &amp;nbsp; &amp;nbsp; P&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 12:22:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate/m-p/865711#M341868</guid>
      <dc:creator>PrinceAde</dc:creator>
      <dc:date>2023-03-22T12:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate/m-p/865812#M341918</link>
      <description>&lt;P&gt;Input data in the form of data step code please.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then show actual numbers based on that example data set. It doesn't have to be big, in fact probably shouldn't be more than 20 rows so you can calculate the numbers by hand and show where they go in the result. Your shown table has no place for the N of the Gender that you show in your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a fairly strong feeling that if you really want that appearance you will have to do a lot of preprocessing of your existing data set and possibly use a different reporting tool. The only way I know to get Tabulate to have different statistics in a column is to have them as ROW dimension expression crossing a class variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You &lt;STRONG&gt;may&lt;/STRONG&gt; be able to get two different tables but they won't be side by side. Something like this:&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.class;
   class sex age;
   var height ;
   table  n age* height*sum ,
         sex all
   ;
   table  pctn age* height*colpctsum,
         sex All
   ;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Mar 2023 22:18:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate/m-p/865812#M341918</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-03-22T22:18:44Z</dc:date>
    </item>
  </channel>
</rss>

