<?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: Force all values of categorical variable to appear in proc tabulate with missing data in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Force-all-values-of-categorical-variable-to-appear-in-proc/m-p/361360#M18691</link>
    <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the end, I created a format for the 52 US states and applied them to the proc tabulate like so:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; PROC TABULATE NOSEPS MISSING FORMAT=7. DATA=tbls;
 CLASS STATEFIP /PRELOADFMT;
 CLASS SERVICES YR;
 TABLES YR, STATEFIP, SERVICES / PRINTMISS MISSTEXT='0';
 WHERE YR = &amp;amp;SAMPLEYR1;
 FORMAT SERVICES SVC. STATEFIP $STATE.;
 RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 24 May 2017 19:52:07 GMT</pubDate>
    <dc:creator>tipscode</dc:creator>
    <dc:date>2017-05-24T19:52:07Z</dc:date>
    <item>
      <title>Force all values of categorical variable to appear in proc tabulate with missing data</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Force-all-values-of-categorical-variable-to-appear-in-proc/m-p/360713#M18672</link>
      <description>&lt;P&gt;In SAS 9.4 I have a dataset where there are US states with missing data for all variables and would like to have those states to still show up in proc tabulate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was considering making an empty dataset with simply all 52 states, along with a dummy variable default to 0, and merge this dataset with the existing dataset to do this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for any suggestions.&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 12:52:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Force-all-values-of-categorical-variable-to-appear-in-proc/m-p/360713#M18672</guid>
      <dc:creator>tipscode</dc:creator>
      <dc:date>2017-05-23T12:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: Force all values of categorical variable to appear in proc tabulate with missing data</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Force-all-values-of-categorical-variable-to-appear-in-proc/m-p/360748#M18674</link>
      <description>&lt;P&gt;Generally with Proc Tabulate the approach for this is to use the option Preloadfmt for the class variable. This does require that you have a format for the variable with all of the levels you want displayed. Then add the Printmiss option to the table options or use order=data for the class variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a very trivial example:&lt;/P&gt;
&lt;PRE&gt;proc format library=work;
value $a
'A' = 'Apple'
'B' = 'Banana'
'C' = 'Cat'
'D' = 'Dog'
;
run;

data tab;
   do grp = 'A','C','D';
     i+1;
     output;
   end;
run;


proc tabulate data= tab;
   class grp/ preloadfmt;
   format grp $a.;
   var i;
   table grp,
         i *(n mean)
         / printmiss;
run;&lt;/PRE&gt;
&lt;P&gt;Note that if you use a multilabel format then the order of statements in the format definition and the options order= will seriously effect the appearance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2017 17:59:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Force-all-values-of-categorical-variable-to-appear-in-proc/m-p/360748#M18674</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-23T17:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: Force all values of categorical variable to appear in proc tabulate with missing data</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Force-all-values-of-categorical-variable-to-appear-in-proc/m-p/361360#M18691</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the end, I created a format for the 52 US states and applied them to the proc tabulate like so:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; PROC TABULATE NOSEPS MISSING FORMAT=7. DATA=tbls;
 CLASS STATEFIP /PRELOADFMT;
 CLASS SERVICES YR;
 TABLES YR, STATEFIP, SERVICES / PRINTMISS MISSTEXT='0';
 WHERE YR = &amp;amp;SAMPLEYR1;
 FORMAT SERVICES SVC. STATEFIP $STATE.;
 RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 May 2017 19:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Force-all-values-of-categorical-variable-to-appear-in-proc/m-p/361360#M18691</guid>
      <dc:creator>tipscode</dc:creator>
      <dc:date>2017-05-24T19:52:07Z</dc:date>
    </item>
  </channel>
</rss>

