<?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: How to get proc tabulate to output a missing value? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812686#M320655</link>
    <description>&lt;P&gt;Why are you using TABULATE instead of SUMMARY if the goal is a DATASET?&lt;/P&gt;</description>
    <pubDate>Wed, 11 May 2022 15:11:33 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-05-11T15:11:33Z</dc:date>
    <item>
      <title>How to get proc tabulate to output a missing value?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812637#M320642</link>
      <description>&lt;P&gt;Hi I am having some trouble getting my proc tab to output a missing value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the proc tab (for reference, the variable "one" is a variable that=1 for all observations):&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 = Want;
class GroupA GroupB GroupC GroupD ap_month;
var count one;
table GroupA=''*GroupB=''*GroupC=''*GroupD=''*sum=''*(one*f=comma14.0),ap_month  /nocellmerge;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which gives a table that looks like this:&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="Table5.PNG" style="width: 907px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71315iA8A27803313014C2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Table5.PNG" alt="Table5.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and output dataset that looks like this:&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="EC27556_0-1652272599494.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71316iA6997443D56C4B0B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EC27556_0-1652272599494.png" alt="EC27556_0-1652272599494.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, in the table you can see a missing value. This missing value does not appear in the output dataset. You can see in between the highlighted rows, there is no 01/03/2021. Is there any way to make proc tabulate output a row in the output dataset for 01/03/2021, where one_sum would = .?&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 12:42:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812637#M320642</guid>
      <dc:creator>EC27556</dc:creator>
      <dc:date>2022-05-11T12:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proc tabulate to output a missing value?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812643#M320643</link>
      <description>Hi:&lt;BR /&gt;  I think you need to investigate the PRINTMISS option of the TABLE statement. It's good to see your code but without some test data, no one can run your code.&lt;BR /&gt;Cynthia</description>
      <pubDate>Wed, 11 May 2022 13:01:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812643#M320643</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2022-05-11T13:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proc tabulate to output a missing value?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812644#M320644</link>
      <description>&lt;P&gt;Try adding the MISSING option to the PROC TABULATE statement.&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 = Want MISSING;
class GroupA GroupB GroupC GroupD ap_month;
var count one;
table GroupA=''*GroupB=''*GroupC=''*GroupD=''*sum=''*(one*f=comma14.0),ap_month  /nocellmerge;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If that doesn't work, try adding it the CLASS statement&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data = Have out = Want MISSING;
class GroupA GroupB GroupC GroupD ap_month / MISSING;
var count one;
table GroupA=''*GroupB=''*GroupC=''*GroupD=''*sum=''*(one*f=comma14.0),ap_month  /nocellmerge;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See also other TABULATE options for dealings with missing, such as MISSPRINT and MISSTEXT.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 13:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812644#M320644</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-05-11T13:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proc tabulate to output a missing value?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812647#M320645</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think your suggestion of printmiss does it.&amp;nbsp; &amp;nbsp;The want_printmiss dataset below has an observation corresponding to the missing cell in the table and absent from the want_normal dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input x y  ;
datalines;
1 1
1 2
2 1
run;
proc tabulate data=have out=want_normal;
  class x y  ;
  tables x,y  ;
run;
proc tabulate data=have out=want_printmiss;
  class x y  ;
  tables x,y  /printmiss;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 May 2022 13:46:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812647#M320645</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-05-11T13:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proc tabulate to output a missing value?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812656#M320646</link>
      <description>&lt;P&gt;Hi, here is some example code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data person;
   input GroupA GroupB GroupC ap_month $ one;
   datalines;
1 1 1 Jan2010 1
1 1 2 Jan2010 1
1 2 1 Jan2010 1
2 1 1 Jan2010 1
2 2 1 Jan2010 1

1 1 1 Jan2011 1
1 1 2 Jan2011 1
1 2 1 Jan2011 1
2 1 1 Jan2011 1

;
/*2 2 1 Jan2011 1*/
run;

proc tabulate data = Person out = want;
class GroupA GroupB GroupC ap_month;
var one;
table GroupA=''*GroupB=''*GroupC=''*sum=''*(one*f=comma14.0),ap_month  /nocellmerge ;
run;
proc tabulate data = Person out = want2;
class GroupA GroupB GroupC ap_month;
var one;
table GroupA=''*GroupB=''*GroupC=''*sum=''*(one*f=comma14.0),ap_month  /nocellmerge printmiss;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here you can see an example of the situation I have going on. You can see the commented out line is basically the missing data - which is then missing in the first proc tabulate table. By using printmiss, it expands the table (which i dont want) and, whilst the wanted output observation is now included in the output data, all the other observations relating to this bigger table are now also included - which i dont want!&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 14:13:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812656#M320646</guid>
      <dc:creator>EC27556</dc:creator>
      <dc:date>2022-05-11T14:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proc tabulate to output a missing value?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812660#M320647</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The missing option does not seem to help unfortunately.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is some example code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data person;
   input GroupA GroupB GroupC ap_month $ one;
   datalines;
1 1 1 Jan2010 1
1 1 2 Jan2010 1
1 2 1 Jan2010 1
2 1 1 Jan2010 1
2 2 1 Jan2010 1

1 1 1 Jan2011 1
1 1 2 Jan2011 1
1 2 1 Jan2011 1
2 1 1 Jan2011 1

;
/*2 2 1 Jan2011 1*/
run;

proc tabulate data = Person out = want;
class GroupA GroupB GroupC ap_month;
var one;
table GroupA=''*GroupB=''*GroupC=''*sum=''*(one*f=comma14.0),ap_month  /nocellmerge ;
run;
proc tabulate data = Person out = want2;
class GroupA GroupB GroupC ap_month;
var one;
table GroupA=''*GroupB=''*GroupC=''*sum=''*(one*f=comma14.0),ap_month  /nocellmerge printmiss;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here you can see an example of the situation I have going on. You can see the commented out line is basically the missing data - which is then missing in the first proc tabulate table. By using printmiss, it expands the table (which i dont want) and, whilst the wanted output observation is now included in the output data, all the other observations relating to this bigger table are now also included - which i dont want!&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 14:16:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812660#M320647</guid>
      <dc:creator>EC27556</dc:creator>
      <dc:date>2022-05-11T14:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proc tabulate to output a missing value?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812681#M320652</link>
      <description>&lt;P&gt;That's a missing category, not missing value. How does SAS know to add in something that doesn't exist in a data set?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use a PRELOADFMT or CLASSDATA to add in categories that are missing/non existent in your data.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.lexjansen.com/nesug/nesug11/cc/cc29.pdf" target="_blank"&gt;https://www.lexjansen.com/nesug/nesug11/cc/cc29.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 14:55:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812681#M320652</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-05-11T14:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proc tabulate to output a missing value?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812686#M320655</link>
      <description>&lt;P&gt;Why are you using TABULATE instead of SUMMARY if the goal is a DATASET?&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 15:11:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-tabulate-to-output-a-missing-value/m-p/812686#M320655</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-11T15:11:33Z</dc:date>
    </item>
  </channel>
</rss>

