<?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 Show frequency 0 in proc tabulate in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Show-frequency-0-in-proc-tabulate/m-p/621861#M182882</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;In the following example I want to show also categories with frequency=0&lt;/P&gt;
&lt;P&gt;In this example there is nobody with category "Left" so I want to show 0 under this category.&lt;/P&gt;
&lt;P&gt;What is the way to do it please using proc tabulate?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data rawtbl;
input ID status ;
cards;
1 2
2 2
3 1
4 3
5 3 
6 2
7 2
8 1
9 3
10 1
;
run;

proc format ;
value oorderCode
1='worse'
2='Better'
3='Same'
4='Left'
;
Run;

title;
PROC TABULATE DATA=rawtbl f=comma21.;
	VAR ID   ;
	CLASS status /	ORDER=UNFORMATTED MISSING;
	TABLE status="" all='TOTAL',
	     ID=''*N='No_Customers'
		 ID=''*pctn='PCT_No_Customers'*f=my1pct. /box="Status";
    format status oorderCode.;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 03 Feb 2020 05:11:35 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2020-02-03T05:11:35Z</dc:date>
    <item>
      <title>Show frequency 0 in proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-frequency-0-in-proc-tabulate/m-p/621861#M182882</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;In the following example I want to show also categories with frequency=0&lt;/P&gt;
&lt;P&gt;In this example there is nobody with category "Left" so I want to show 0 under this category.&lt;/P&gt;
&lt;P&gt;What is the way to do it please using proc tabulate?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data rawtbl;
input ID status ;
cards;
1 2
2 2
3 1
4 3
5 3 
6 2
7 2
8 1
9 3
10 1
;
run;

proc format ;
value oorderCode
1='worse'
2='Better'
3='Same'
4='Left'
;
Run;

title;
PROC TABULATE DATA=rawtbl f=comma21.;
	VAR ID   ;
	CLASS status /	ORDER=UNFORMATTED MISSING;
	TABLE status="" all='TOTAL',
	     ID=''*N='No_Customers'
		 ID=''*pctn='PCT_No_Customers'*f=my1pct. /box="Status";
    format status oorderCode.;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Feb 2020 05:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-frequency-0-in-proc-tabulate/m-p/621861#M182882</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-02-03T05:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Show frequency 0 in proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-frequency-0-in-proc-tabulate/m-p/621864#M182884</link>
      <description>&lt;P&gt;You may find your answer here: &lt;A href="https://communities.sas.com/t5/SAS-Procedures/How-To-Shows-PROC-TABULATE-s-Empty-Rows/td-p/285178" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/How-To-Shows-PROC-TABULATE-s-Empty-Rows/td-p/285178&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Plus probably the MISSING = 0 SAS option.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 05:19:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-frequency-0-in-proc-tabulate/m-p/621864#M182884</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-02-03T05:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Show frequency 0 in proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-frequency-0-in-proc-tabulate/m-p/621868#M182885</link>
      <description>&lt;P&gt;I know how to do it in proc report&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=rawtbl nowd completerows;
column ID status PCTN;
define status /group format=oorderCode. preloadfmt exclusive;
define ID /N format=4. 'Freq';
define PCTN / 'PCTN' format=percent9.1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Feb 2020 05:23:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-frequency-0-in-proc-tabulate/m-p/621868#M182885</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-02-03T05:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: Show frequency 0 in proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Show-frequency-0-in-proc-tabulate/m-p/621871#M182887</link>
      <description>&lt;P&gt;Great.&lt;/P&gt;
&lt;P&gt;As I see the answer is to use PRELOADFMT&amp;nbsp; option&amp;nbsp; with&amp;nbsp;Printmiss&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title;
PROC TABULATE DATA=rawtbl f=comma21.;
	VAR ID   ;
	CLASS status / MISSING PRELOADFMT;
	TABLE status="" all='TOTAL',
	     ID=''*N='No_Customers'
		 ID=''*pctn='PCT_No_Customers'*f=my1pct. /box="Status" Printmiss MissText='';
    format status oorderCode. ;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 05:44:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Show-frequency-0-in-proc-tabulate/m-p/621871#M182887</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-02-03T05:44:51Z</dc:date>
    </item>
  </channel>
</rss>

