<?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 doesn't match Proc Freq in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-doesn-t-match-Proc-Freq/m-p/501942#M133913</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to estimate the proportion of obesity (0,1 dummy variable) among&amp;nbsp;my study population by a variable for a duration category(durcat) and other covariates. The first row in the table is meant to be the overall proportion of obesity by durcat levels. However, outputs from proc tabulate and proc freq do NOT match. So puzzling.I'm only interested in data among people belong to (agecat=5).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why would it happen? Please help if you see what I'm doing wrong here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Output from:&lt;/P&gt;
&lt;P&gt;proc freq data=a;&lt;BR /&gt;tables durcat/list;&lt;BR /&gt;where agecat=5; &lt;BR /&gt;run;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" rules="all" frame="box" cellspacing="0" cellpadding="5" summary="Procedure Freq: One-Way Frequencies"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r b header" scope="col"&gt;durcat&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Frequency&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Percent&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Cumulative&lt;BR /&gt;Frequency&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Cumulative&lt;BR /&gt;Percent&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="r data"&gt;160207&lt;/TD&gt;
&lt;TD class="r data"&gt;17.31&lt;/TD&gt;
&lt;TD class="r data"&gt;160207&lt;/TD&gt;
&lt;TD class="r data"&gt;17.31&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="r data"&gt;86663&lt;/TD&gt;
&lt;TD class="r data"&gt;9.36&lt;/TD&gt;
&lt;TD class="r data"&gt;246870&lt;/TD&gt;
&lt;TD class="r data"&gt;26.67&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="r data"&gt;73166&lt;/TD&gt;
&lt;TD class="r data"&gt;7.90&lt;/TD&gt;
&lt;TD class="r data"&gt;320036&lt;/TD&gt;
&lt;TD class="r data"&gt;34.57&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;4&lt;/TH&gt;
&lt;TD class="r data"&gt;279301&lt;/TD&gt;
&lt;TD class="r data"&gt;30.17&lt;/TD&gt;
&lt;TD class="r data"&gt;599337&lt;/TD&gt;
&lt;TD class="r data"&gt;64.74&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;5&lt;/TH&gt;
&lt;TD class="r data"&gt;326435&lt;/TD&gt;
&lt;TD class="r data"&gt;35.26&lt;/TD&gt;
&lt;TD class="r data"&gt;925772&lt;/TD&gt;
&lt;TD class="r data"&gt;
&lt;P&gt;100.00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Tabulate output and proc freq output from below clodes:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="proc tab vs proc freq.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23806iCC7F74C4393A2070/image-size/large?v=v2&amp;amp;px=999" role="button" title="proc tab vs proc freq.png" alt="proc tab vs proc freq.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=a order=internal;
var ob;
class durcat agecat race1 assist fam_size hh_smoking area area1 birth_wt bf_ever bf_months 
      migrant_status hb_cat;
tables (All agecat race1 assist fam_size hh_smoking area area1 birth_wt bf_ever bf_months 
        migrant_status hb_cat), 
	   (N colpctn*f=5.1) ob*(durcat)*(mean*f=percent7.1)/nocellmerge printmiss;&lt;BR /&gt;where agecat=5;
run; 

proc freq data=a;
tables ob/list;
where durcat=5 and agecat=5;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Note that you said output from:&lt;/P&gt;
&lt;P&gt;proc freq data=a;&lt;BR /&gt;tables durcat/list;&lt;BR /&gt;where agecat=5; &lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;And then posted code as:&lt;/P&gt;
&lt;PRE&gt;proc freq data=a;
tables ob/list;
where durcat=5 and agecat=5;
run;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Any time you use a WHERE clause to reduce data it is a good idea to do so in the other procedure so they both start with the&amp;nbsp;same base records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Oct 2018 15:17:01 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-10-05T15:17:01Z</dc:date>
    <item>
      <title>Proc Tabulate doesn't match Proc Freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-doesn-t-match-Proc-Freq/m-p/501846#M133860</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to estimate the proportion of obesity (0,1 dummy variable) among&amp;nbsp;my study population by a variable for a duration category(durcat) and other covariates. The first row in the table is meant to be the overall proportion of obesity by durcat levels. However, outputs from proc tabulate and proc freq do NOT match. So puzzling.I'm only interested in data among people belong to (agecat=5).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why would it happen? Please help if you see what I'm doing wrong here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Output from:&lt;/P&gt;
&lt;P&gt;proc freq data=a;&lt;BR /&gt;tables durcat/list;&lt;BR /&gt;where agecat=5; &lt;BR /&gt;run;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Freq: One-Way Frequencies" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r b header" scope="col"&gt;durcat&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Frequency&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Percent&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Cumulative&lt;BR /&gt;Frequency&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Cumulative&lt;BR /&gt;Percent&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="r data"&gt;160207&lt;/TD&gt;
&lt;TD class="r data"&gt;17.31&lt;/TD&gt;
&lt;TD class="r data"&gt;160207&lt;/TD&gt;
&lt;TD class="r data"&gt;17.31&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="r data"&gt;86663&lt;/TD&gt;
&lt;TD class="r data"&gt;9.36&lt;/TD&gt;
&lt;TD class="r data"&gt;246870&lt;/TD&gt;
&lt;TD class="r data"&gt;26.67&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="r data"&gt;73166&lt;/TD&gt;
&lt;TD class="r data"&gt;7.90&lt;/TD&gt;
&lt;TD class="r data"&gt;320036&lt;/TD&gt;
&lt;TD class="r data"&gt;34.57&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;4&lt;/TH&gt;
&lt;TD class="r data"&gt;279301&lt;/TD&gt;
&lt;TD class="r data"&gt;30.17&lt;/TD&gt;
&lt;TD class="r data"&gt;599337&lt;/TD&gt;
&lt;TD class="r data"&gt;64.74&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;5&lt;/TH&gt;
&lt;TD class="r data"&gt;326435&lt;/TD&gt;
&lt;TD class="r data"&gt;35.26&lt;/TD&gt;
&lt;TD class="r data"&gt;925772&lt;/TD&gt;
&lt;TD class="r data"&gt;
&lt;P&gt;100.00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Tabulate output and proc freq output from below clodes:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="proc tab vs proc freq.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23806iCC7F74C4393A2070/image-size/large?v=v2&amp;amp;px=999" role="button" title="proc tab vs proc freq.png" alt="proc tab vs proc freq.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=a order=internal;
var ob;
class durcat agecat race1 assist fam_size hh_smoking area area1 birth_wt bf_ever bf_months 
      migrant_status hb_cat;
tables (All agecat race1 assist fam_size hh_smoking area area1 birth_wt bf_ever bf_months 
        migrant_status hb_cat), 
	   (N colpctn*f=5.1) ob*(durcat)*(mean*f=percent7.1)/nocellmerge printmiss;&lt;BR /&gt;where agecat=5;
run; 

proc freq data=a;
tables ob/list;
where durcat=5 and agecat=5;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 12:17:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-doesn-t-match-Proc-Freq/m-p/501846#M133860</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2018-10-05T12:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate doesn't match Proc Freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-doesn-t-match-Proc-Freq/m-p/501848#M133861</link>
      <description>&lt;P&gt;PROC TABULATE is automatically removing some of the observations.&amp;nbsp; More specifically, any time any of the CLASS variables has a missing value (whether or not it is used in your table) the observation gets removed from the calculations.&amp;nbsp; You can change that by adding the MISSING option on the PROC statement.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 11:56:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-doesn-t-match-Proc-Freq/m-p/501848#M133861</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-10-05T11:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate doesn't match Proc Freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-doesn-t-match-Proc-Freq/m-p/501851#M133863</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;thank you,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using missing function in proc tab solved ignoring missing option and improved the descriptive numbers for the other covariates, such as migrant-status for example. However, I still get different outputs from proc tabulate anf proc freq on my main variable obesity by durcat. Any idea or hints? Typo in the screenshot. I meant with missing not within missing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IMPROVED.png" style="width: 495px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23807iDB629EBB555C2D9A/image-size/large?v=v2&amp;amp;px=999" role="button" title="IMPROVED.png" alt="IMPROVED.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;proc tabulate data=a missing order=internal;&lt;BR /&gt;var ob;&lt;BR /&gt;class durcat agecat race1 assist fam_size hh_smoking area area1 birth_wt bf_ever bf_months &lt;BR /&gt; migrant_status hb_cat;&lt;BR /&gt;tables (All agecat race1 assist fam_size hh_smoking area area1 birth_wt bf_ever bf_months &lt;BR /&gt; migrant_status hb_cat), &lt;BR /&gt; (N colpctn*f=5.1) ob*(durcat)*(mean*f=percent7.1)/nocellmerge printmiss;&lt;BR /&gt;format assist $assist. race1 race. birth_wt birth_wt. bf_months bf_months.;&lt;BR /&gt;where agecat=5 and geography not in ('99','nyc'); &lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc freq data=a;&lt;BR /&gt;tables ob/list;&lt;BR /&gt;where durcat=5;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 12:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-doesn-t-match-Proc-Freq/m-p/501851#M133863</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2018-10-05T12:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate doesn't match Proc Freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-doesn-t-match-Proc-Freq/m-p/501868#M133868</link>
      <description>&lt;P&gt;I'm not sure where the difference is coming from, but I know where to look.&amp;nbsp; Forget about the mean and look at N. PROC FREQ is processing a total of 326,435 observations, while PROC TABULATE is working with 372,667 observations.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 13:03:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-doesn-t-match-Proc-Freq/m-p/501868#M133868</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-10-05T13:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate doesn't match Proc Freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-doesn-t-match-Proc-Freq/m-p/501877#M133874</link>
      <description>Hmmm, good catch. Thanks</description>
      <pubDate>Fri, 05 Oct 2018 13:13:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-doesn-t-match-Proc-Freq/m-p/501877#M133874</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2018-10-05T13:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate doesn't match Proc Freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-doesn-t-match-Proc-Freq/m-p/501942#M133913</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to estimate the proportion of obesity (0,1 dummy variable) among&amp;nbsp;my study population by a variable for a duration category(durcat) and other covariates. The first row in the table is meant to be the overall proportion of obesity by durcat levels. However, outputs from proc tabulate and proc freq do NOT match. So puzzling.I'm only interested in data among people belong to (agecat=5).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why would it happen? Please help if you see what I'm doing wrong here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Output from:&lt;/P&gt;
&lt;P&gt;proc freq data=a;&lt;BR /&gt;tables durcat/list;&lt;BR /&gt;where agecat=5; &lt;BR /&gt;run;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" rules="all" frame="box" cellspacing="0" cellpadding="5" summary="Procedure Freq: One-Way Frequencies"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r b header" scope="col"&gt;durcat&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Frequency&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Percent&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Cumulative&lt;BR /&gt;Frequency&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Cumulative&lt;BR /&gt;Percent&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="r data"&gt;160207&lt;/TD&gt;
&lt;TD class="r data"&gt;17.31&lt;/TD&gt;
&lt;TD class="r data"&gt;160207&lt;/TD&gt;
&lt;TD class="r data"&gt;17.31&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="r data"&gt;86663&lt;/TD&gt;
&lt;TD class="r data"&gt;9.36&lt;/TD&gt;
&lt;TD class="r data"&gt;246870&lt;/TD&gt;
&lt;TD class="r data"&gt;26.67&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="r data"&gt;73166&lt;/TD&gt;
&lt;TD class="r data"&gt;7.90&lt;/TD&gt;
&lt;TD class="r data"&gt;320036&lt;/TD&gt;
&lt;TD class="r data"&gt;34.57&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;4&lt;/TH&gt;
&lt;TD class="r data"&gt;279301&lt;/TD&gt;
&lt;TD class="r data"&gt;30.17&lt;/TD&gt;
&lt;TD class="r data"&gt;599337&lt;/TD&gt;
&lt;TD class="r data"&gt;64.74&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;5&lt;/TH&gt;
&lt;TD class="r data"&gt;326435&lt;/TD&gt;
&lt;TD class="r data"&gt;35.26&lt;/TD&gt;
&lt;TD class="r data"&gt;925772&lt;/TD&gt;
&lt;TD class="r data"&gt;
&lt;P&gt;100.00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Tabulate output and proc freq output from below clodes:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="proc tab vs proc freq.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23806iCC7F74C4393A2070/image-size/large?v=v2&amp;amp;px=999" role="button" title="proc tab vs proc freq.png" alt="proc tab vs proc freq.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=a order=internal;
var ob;
class durcat agecat race1 assist fam_size hh_smoking area area1 birth_wt bf_ever bf_months 
      migrant_status hb_cat;
tables (All agecat race1 assist fam_size hh_smoking area area1 birth_wt bf_ever bf_months 
        migrant_status hb_cat), 
	   (N colpctn*f=5.1) ob*(durcat)*(mean*f=percent7.1)/nocellmerge printmiss;&lt;BR /&gt;where agecat=5;
run; 

proc freq data=a;
tables ob/list;
where durcat=5 and agecat=5;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Note that you said output from:&lt;/P&gt;
&lt;P&gt;proc freq data=a;&lt;BR /&gt;tables durcat/list;&lt;BR /&gt;where agecat=5; &lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;And then posted code as:&lt;/P&gt;
&lt;PRE&gt;proc freq data=a;
tables ob/list;
where durcat=5 and agecat=5;
run;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Any time you use a WHERE clause to reduce data it is a good idea to do so in the other procedure so they both start with the&amp;nbsp;same base records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 15:17:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-doesn-t-match-Proc-Freq/m-p/501942#M133913</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-10-05T15:17:01Z</dc:date>
    </item>
  </channel>
</rss>

