<?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: tabulate denominator question with A B AxB row variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/tabulate-denominator-question-with-A-B-AxB-row-variables/m-p/759062#M239799</link>
    <description>&lt;P&gt;Thanks. from what you've written it looks like I can't have the sex x age combination in the same tabulate as the (sex age) table for the percents to work properly. I will try that.&lt;/P&gt;&lt;P&gt;thanks again&lt;/P&gt;&lt;P&gt;Julia&lt;/P&gt;</description>
    <pubDate>Tue, 03 Aug 2021 15:50:53 GMT</pubDate>
    <dc:creator>juliarushing</dc:creator>
    <dc:date>2021-08-03T15:50:53Z</dc:date>
    <item>
      <title>tabulate denominator question with A B AxB row variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/tabulate-denominator-question-with-A-B-AxB-row-variables/m-p/759039#M239781</link>
      <description>&lt;P&gt;Hi.&amp;nbsp; I'm trying to produce some nested percents but can't seem to find the right denominator.&amp;nbsp; my original table statement looks something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tables RACE AGEGROUP RACE x AGEGROUP, ALL*(n*f=8. colpctn*f=8.1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;all percents are correct until it comes to the RACE x AGEGROUP section.&amp;nbsp; I want the percents to add up to 100 across all agegroups within RACE, but of course SAS is providing percents that add up to 100 across the TOTAL N. I've tried various combinations of using PCTN and I can't fix it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice is appreciated!&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Julia&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 14:47:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/tabulate-denominator-question-with-A-B-AxB-row-variables/m-p/759039#M239781</guid>
      <dc:creator>juliarushing</dc:creator>
      <dc:date>2021-08-03T14:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: tabulate denominator question with A B AxB row variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/tabulate-denominator-question-with-A-B-AxB-row-variables/m-p/759050#M239790</link>
      <description>&lt;P&gt;Please show entire procedure code.&lt;/P&gt;
&lt;P&gt;If you want to use a different denominator for some parts of table you would either have to restructure you code so the statistics are associated with the row or possibly use a different table statement within the procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can specify a denominator for PCTN or PCTSUM using the syntax Pctn&amp;lt;var&amp;gt;&amp;nbsp; :(DO not use with any other percent statistics you may make SAS unstable). However since you are using three different sets of row variables you do not want to specify the same denominator for agegroup, race, and the combined race*agegroup. So the syntax gets a bit more complicated.&lt;/P&gt;
&lt;P&gt;Here are a couple of approaches with a data set you can test code against showing something similar to your existing code and two different approaches to solutions. Note that your ALL as shown only actually has much affect in the last block.&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.class;
   class sex age;
   /* your code equivalent*/
   table sex age sex*age,
         ALL*(n*f=8. colpctn*f=8.1)
    ;
   /* separate table for sex*age*/
   table sex age,
         ALL*(n*f=8. colpctn*f=8.1)
    ;
      /* this has the ages total 100pct within Sex*/
   table sex* age,
         ALL*(n*f=8. pctn&amp;lt;age&amp;gt;*f=8.1)
    ;
    /* or statistics in rows*/
    table (sex age)*  (n*f=8. colpctn*f=8.1) sex*age*(n*f=8. pctn&amp;lt;sex&amp;gt;*f=8.1),
          all
    ;
         

run; &lt;/PRE&gt;
&lt;P&gt;Interaction with more variables will likely make things more interesting.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 15:32:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/tabulate-denominator-question-with-A-B-AxB-row-variables/m-p/759050#M239790</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-03T15:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: tabulate denominator question with A B AxB row variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/tabulate-denominator-question-with-A-B-AxB-row-variables/m-p/759062#M239799</link>
      <description>&lt;P&gt;Thanks. from what you've written it looks like I can't have the sex x age combination in the same tabulate as the (sex age) table for the percents to work properly. I will try that.&lt;/P&gt;&lt;P&gt;thanks again&lt;/P&gt;&lt;P&gt;Julia&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 15:50:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/tabulate-denominator-question-with-A-B-AxB-row-variables/m-p/759062#M239799</guid>
      <dc:creator>juliarushing</dc:creator>
      <dc:date>2021-08-03T15:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: tabulate denominator question with A B AxB row variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/tabulate-denominator-question-with-A-B-AxB-row-variables/m-p/759064#M239800</link>
      <description>&lt;P&gt;yes, I see now that if I run the sex x age tabulation separately with pctn&amp;lt;age&amp;gt; the percents are correct but when this is included along with sex and age in the table the percents do not work, even though I am using&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; tables sex age sex*age, all*(n pctn &amp;lt; sex age age&amp;gt;).&amp;nbsp; (does not calculate denom. correctly for sex x age)&lt;/P&gt;&lt;P&gt;tables sex*age,all*(n pctn&amp;lt;age&amp;gt;) does calculate denom correctly. weird.&lt;/P&gt;&lt;P&gt;guess if I'm determined to have all vars in the same table statement I'll have to replace the SEX&amp;nbsp; x AGE term with a newly derived SEXAGE var.&lt;/P&gt;&lt;P&gt;thanks again&lt;/P&gt;&lt;P&gt;Julia&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 16:01:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/tabulate-denominator-question-with-A-B-AxB-row-variables/m-p/759064#M239800</guid>
      <dc:creator>juliarushing</dc:creator>
      <dc:date>2021-08-03T16:01:24Z</dc:date>
    </item>
  </channel>
</rss>

