<?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: Count results between Proc Freq and Proc Tabulate are not consistent? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/867019#M342413</link>
    <description>&lt;P&gt;I added Missing option in the Proc Tabulate table; I found out all the Age_group counts are increasing to the same as the Proc Freq.&amp;nbsp; So my question is, although no missing value in the Age_group, if there are missing value in other class (Sex or Race), Proc Tabulate is counting the subjects that are not missing in any of the three classes.&amp;nbsp; Am I right?&lt;/P&gt;</description>
    <pubDate>Wed, 29 Mar 2023 14:34:45 GMT</pubDate>
    <dc:creator>ybz12003</dc:creator>
    <dc:date>2023-03-29T14:34:45Z</dc:date>
    <item>
      <title>Count results between Proc Freq and Proc Tabulate are not consistent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/866985#M342401</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the following sample codes listed below. I found out that the Age_group counts in Proc Freg are much higher than the sum of Proc Tabulate [(Underly=0)+(Underly=1)].&amp;nbsp; Could anyone explain this strange situation?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test_1;
	set test;

	if  2 =&amp;lt; ageyears =&amp;lt; 4 then Age_group=1;
	else if 5 &amp;lt;= ageyears &amp;lt;= 11 then Age_group=2;
	else if 12 &amp;lt;= ageyears &amp;lt;= 17 then Age_group=3;

	if preterm=1 or lung=1 or airway=1 or heart=1 or gastro=1 or endo=1 or heme=1 or immuncpm=1 or gm=1 or other=1 then Underly=1;
	else Underly=0;		
run;

Proc freq data=test_1;
table Underly/missing;
where Age_group in (1,2,3);
run;

proc tabulate data=test_1;
   class Age_group Sex race C_Underly;
   tables (Age_group Sex race)*(n colpctn*f=4.2), Underly;
   where Age_group in (1,2,3);
   format Age_group Age_group. Sex Sex. Race Race.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Mar 2023 13:43:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/866985#M342401</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-03-29T13:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: Count results between Proc Freq and Proc Tabulate are not consistent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/866988#M342402</link>
      <description>&lt;P&gt;Can you please show us the output, so we can see what is different?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please show us the data (or a portion of it) in data set TEST_1 &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;as working SAS data step code&lt;/STRONG&gt;&lt;/FONT&gt;, so we can see what the program is doing on your data (as you did in an &lt;A href="https://communities.sas.com/t5/SAS-Programming/Update-charge-amount-based-on-different-timeline-and-multiply/m-p/864094#M341268" target="_self"&gt;earlier thread&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 13:51:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/866988#M342402</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-03-29T13:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Count results between Proc Freq and Proc Tabulate are not consistent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/866992#M342403</link>
      <description>&lt;P&gt;Proc Freq Age_group=1, N=8678&lt;/P&gt;
&lt;P&gt;Proc Tabulate Underly=0 Age_group=1196&lt;/P&gt;
&lt;P&gt;Proc Tabulate Underly=1 Age_group=2328&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As shown above, Sum N [Underly=0 + Underly=1] not equal Freq N&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 13:55:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/866992#M342403</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-03-29T13:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: Count results between Proc Freq and Proc Tabulate are not consistent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/866993#M342404</link>
      <description>&lt;P&gt;Why do I have to ask twice to see (a portion of) the data? I shouldn't even have to ask once, by now &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt; you should know we are going to ask to see (a portion of) the data. &lt;STRONG&gt;You should just provide the data without us even asking&lt;/STRONG&gt;. This will enable us to provide you with quicker and better answers.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 13:59:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/866993#M342404</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-03-29T13:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: Count results between Proc Freq and Proc Tabulate are not consistent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/866996#M342406</link>
      <description>&lt;P&gt;If you have missing values for any of the CLASS variables, add the MISSING option to your PROC TABULATE statement.&amp;nbsp; Otherwise a record with a missing value for any class variable will be excluded from the table.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 14:02:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/866996#M342406</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-03-29T14:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Count results between Proc Freq and Proc Tabulate are not consistent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/867006#M342410</link>
      <description>I would like to exclude the missing value.  The Age_group counts were the same when I used Missing option in the Proc Freq statement.  With that means, when Age_group=1 counts are 8678 with or without missing option.</description>
      <pubDate>Wed, 29 Mar 2023 14:19:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/867006#M342410</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-03-29T14:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: Count results between Proc Freq and Proc Tabulate are not consistent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/867019#M342413</link>
      <description>&lt;P&gt;I added Missing option in the Proc Tabulate table; I found out all the Age_group counts are increasing to the same as the Proc Freq.&amp;nbsp; So my question is, although no missing value in the Age_group, if there are missing value in other class (Sex or Race), Proc Tabulate is counting the subjects that are not missing in any of the three classes.&amp;nbsp; Am I right?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 14:34:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/867019#M342413</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-03-29T14:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Count results between Proc Freq and Proc Tabulate are not consistent?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/867038#M342414</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I added Missing option in the Proc Tabulate table; I found out all the Age_group counts are increasing to the same as the Proc Freq.&amp;nbsp; So my question is, although no missing value in the Age_group, if there are missing value in other class (Sex or Race), Proc Tabulate is counting the subjects that are not missing in any of the three classes.&amp;nbsp; Am I right?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Any variable that appears on a CLASS statement that does not include the option MISSING will exclude the observations with missing values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that you can have multiple CLASS statements in Proc Tabulate with different options. So you may leverage this behavior if desirable by including some variables on a Class statement with missing and others on a different Class statement without the missing.&lt;/P&gt;
&lt;P&gt;I think my person maximum for Class statements in a single Proc Tabulate call is seven. Using ORDER= options, PRELOADFMT and/or MLF (Tabulate being one of the few procedures that support multilabel formats) and mixes of Missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you haven't noticed yet Tabulate will also allow multiple table statements though all tables will use the same Class, Classlev, Var and other non-Table statement settings.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 14:48:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-results-between-Proc-Freq-and-Proc-Tabulate-are-not/m-p/867038#M342414</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-03-29T14:48:29Z</dc:date>
    </item>
  </channel>
</rss>

