<?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: BASE SAS: How to make subgroup pct in tabulate in SAS Community Nordic</title>
    <link>https://communities.sas.com/t5/SAS-Community-Nordic/BASE-SAS-How-to-make-subgroup-pct-in-tabulate/m-p/373857#M84</link>
    <description>&lt;P&gt;Thanks for the quick response. Works perfect.&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jul 2017 08:49:16 GMT</pubDate>
    <dc:creator>kimer</dc:creator>
    <dc:date>2017-07-07T08:49:16Z</dc:date>
    <item>
      <title>BASE SAS: How to make subgroup pct in tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Community-Nordic/BASE-SAS-How-to-make-subgroup-pct-in-tabulate/m-p/373613#M82</link>
      <description>&lt;P&gt;I'm looking for a denominator syntax for subgroups total in proc tabulate. My "product" is a report with 2 across groups. Rowgroups are dynamic multible. Case with sashelp.class below. The problem is that subgroup total for F and M is not 100 but the same as rowpctsum. Other calculations er ok. Normaly solved in proc report, but report make a column for every combination (se age 11 and 15). To remove these we have to made both data step and macro loop in compute statement. Solution with a subgroup total in dataset with sql give a problem in the "all" statement.&lt;/P&gt;&lt;P&gt;Any idees?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;
firstl = substr(name,1,1);
run;


proc tabulate data=class;
where firstl in ("J","A");
class firstl sex age;
var height;
table (all="Total" firstl="") * (height="SUM"*sum=""
								height="PCT totalrække"*rowpctsum=""
								height="PCT subgroup"*pctsum&amp;lt;sex*all  age all&amp;gt;=""
								), sex=" "  * (age="" all="I alt") all="Total" 
							/ box="Udfordring: PCT subgroup f*ialt=100% og m*ialt=100 ";
run;

proc report data=class nowd;
  title 'I report medtages alle kolonnekombinationer i _cn_ -&amp;gt; fjernes ved noprint og macro loop i compute';
  where firstl in ("J","A");
  column firstl n sex, age ;
  define firstl / group;
  define sex / across;
  define age / across ;
  rbreak after /summarize;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Jul 2017 11:59:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Community-Nordic/BASE-SAS-How-to-make-subgroup-pct-in-tabulate/m-p/373613#M82</guid>
      <dc:creator>kimer</dc:creator>
      <dc:date>2017-07-06T11:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: BASE SAS: How to make subgroup pct in tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Community-Nordic/BASE-SAS-How-to-make-subgroup-pct-in-tabulate/m-p/373854#M83</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think this syntax will give you your subgroup percentages:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;proc tabulate data=class;&lt;BR /&gt;where firstl in ("J","A");&lt;BR /&gt;class firstl sex age;&lt;BR /&gt;var height;&lt;BR /&gt;table (all="Total" firstl="") * (height="SUM"*sum=""&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;height="PCT totalrække"*rowpctsum=""&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;height="PCT subgroup"*pctsum&amp;lt;&lt;STRONG&gt;age all&lt;/STRONG&gt;&amp;gt;=""&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;), sex=" "&amp;nbsp; * (age="" all="I alt") all="Total" &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;/ box="Udfordring: PCT subgroup f*ialt=100% og m*ialt=100 ";&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The clue is to use the subgroup variables for the denominator in the pctsum expression, which is "age all" in your example.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 08:09:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Community-Nordic/BASE-SAS-How-to-make-subgroup-pct-in-tabulate/m-p/373854#M83</guid>
      <dc:creator>KristianLønø</dc:creator>
      <dc:date>2017-07-07T08:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: BASE SAS: How to make subgroup pct in tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Community-Nordic/BASE-SAS-How-to-make-subgroup-pct-in-tabulate/m-p/373857#M84</link>
      <description>&lt;P&gt;Thanks for the quick response. Works perfect.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 08:49:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Community-Nordic/BASE-SAS-How-to-make-subgroup-pct-in-tabulate/m-p/373857#M84</guid>
      <dc:creator>kimer</dc:creator>
      <dc:date>2017-07-07T08:49:16Z</dc:date>
    </item>
  </channel>
</rss>

