<?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 How to output missing categories with proc tabulate in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-output-missing-categories-with-proc-tabulate/m-p/779944#M248456</link>
    <description>&lt;P&gt;I have a table with two group columns. One is a time variable and the other is just a group like the one below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	Data have(drop=x);
	Do x = 1 to 6;
		year = 2010;
		group = 2;
		output;
	End;
	Do x = 1 to 6;
		year = 2020;
		group = ceil(x/3);
		output;
	End;
	Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am attempting to calculate the share of observations by year and group in the following manner:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	Proc tabulate data=have out=not_want(drop=_type_ _page_ _table_);
	Class year / missing;
	Class group / missing;
	Table group='',year=''*colpctn='';
	Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The results window shows the desired results, however the output table does not contain the missing value from the year 2010. This is the expected output:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	Data want;
	year = 2010; group=1; share=100; output;
	year = 2010; group=2; share=.; output;
	year = 2020; group=1; share=50; output;
	year = 2020; group=2; share=50; output;
	Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Nov 2021 09:50:12 GMT</pubDate>
    <dc:creator>kashlik123</dc:creator>
    <dc:date>2021-11-12T09:50:12Z</dc:date>
    <item>
      <title>How to output missing categories with proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-output-missing-categories-with-proc-tabulate/m-p/779944#M248456</link>
      <description>&lt;P&gt;I have a table with two group columns. One is a time variable and the other is just a group like the one below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	Data have(drop=x);
	Do x = 1 to 6;
		year = 2010;
		group = 2;
		output;
	End;
	Do x = 1 to 6;
		year = 2020;
		group = ceil(x/3);
		output;
	End;
	Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am attempting to calculate the share of observations by year and group in the following manner:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	Proc tabulate data=have out=not_want(drop=_type_ _page_ _table_);
	Class year / missing;
	Class group / missing;
	Table group='',year=''*colpctn='';
	Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The results window shows the desired results, however the output table does not contain the missing value from the year 2010. This is the expected output:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	Data want;
	year = 2010; group=1; share=100; output;
	year = 2010; group=2; share=.; output;
	year = 2020; group=1; share=50; output;
	year = 2020; group=2; share=50; output;
	Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 09:50:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-output-missing-categories-with-proc-tabulate/m-p/779944#M248456</guid>
      <dc:creator>kashlik123</dc:creator>
      <dc:date>2021-11-12T09:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to output missing categories with proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-output-missing-categories-with-proc-tabulate/m-p/779945#M248457</link>
      <description>&lt;P&gt;Is it a requirement to do this with Proc Tabulate?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 09:57:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-output-missing-categories-with-proc-tabulate/m-p/779945#M248457</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-11-12T09:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to output missing categories with proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-output-missing-categories-with-proc-tabulate/m-p/779946#M248458</link>
      <description>&lt;P&gt;If there is another solution, which is just as compact and fast then sure, other option can be considered. For example doing this through PROC SQL takes too much time, as my real dataset is quite big.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 10:03:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-output-missing-categories-with-proc-tabulate/m-p/779946#M248458</guid>
      <dc:creator>kashlik123</dc:creator>
      <dc:date>2021-11-12T10:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to output missing categories with proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-output-missing-categories-with-proc-tabulate/m-p/779947#M248459</link>
      <description>&lt;P&gt;Ok. You can use the Printmiss Option in the Table Statement like this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will give you a 0 in the output pct, which is more correct than a missing value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if this works for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc tabulate data=have out=not_want(drop=_type_ _page_ _table_);
   Class year / missing;
   Class group / missing;
   Table group='',year=''*colpctn='' / printmiss;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Nov 2021 10:08:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-output-missing-categories-with-proc-tabulate/m-p/779947#M248459</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-11-12T10:08:22Z</dc:date>
    </item>
  </channel>
</rss>

