<?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: Show all categories (even with no cases) in PROC TABULATE in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Show-all-categories-even-with-no-cases-in-PROC-TABULATE/m-p/647627#M22174</link>
    <description>&lt;P&gt;When I ran your code (SAS On Demand) I get this error message in the log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; WARNING: PreloadFmt will have no effect on the output without one of the following options: "printmiss", "order=data", or the class 
          statement option "exclusive".&lt;/PRE&gt;
&lt;P&gt;I then added the printmiss statement to the TABLE statement and it works as expected. You can add misstext to have them show as 0 rather than a period.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	TABLE group, residenceStatus * age / printmiss misstext='0';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/324367"&gt;@dstuder&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello everybody!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the following sample data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;DATA offenders;
INPUT group :$1. age :3. residenceStatus :$1. sex :$1.;
INFILE DATALINES DSD;
DATALINES;
A,10,A,m
A,14,A,m
A,11,B,m
B,21,A,w
B,20,B,m
B,,B,m
B,34,C,m
A,60,C,w
;
RUN;

PROC FORMAT;
VALUE agegrp 0-10 = "0-10"
			 11-20 = "11-20"
			 21-30 =  "21-30"
             31-40 = "31-40"&lt;BR /&gt;             40-hight = "41+"
			 . = "unknown";
RUN;&lt;/PRE&gt;
&lt;P&gt;and the following proc tabulate:&lt;/P&gt;
&lt;PRE&gt;PROC TABULATE;
	class group; 
	class age / preloadfmt missing;
	class residenceStatus;
	TABLE group, residenceStatus * age;
	FORMAT age agegrp.;
RUN;&lt;/PRE&gt;
&lt;P&gt;How can I repeat all agegroups (0-10, 11-20, 21-30, unknown) for every residence status (A, B, C)?&lt;/P&gt;
&lt;P&gt;I have experimented somewhat with "preloadfmt" but didn't get it to work properly. Thanks for help!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 May 2020 20:54:48 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-05-13T20:54:48Z</dc:date>
    <item>
      <title>Show all categories (even with no cases) in PROC TABULATE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Show-all-categories-even-with-no-cases-in-PROC-TABULATE/m-p/647612#M22171</link>
      <description>&lt;P&gt;Hello everybody!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following sample data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA offenders;
INPUT group :$1. age :3. residenceStatus :$1. sex :$1.;
INFILE DATALINES DSD;
DATALINES;
A,10,A,m
A,14,A,m
A,11,B,m
B,21,A,w
B,20,B,m
B,,B,m
B,34,C,m
A,60,C,w
;
RUN;

PROC FORMAT;
VALUE agegrp 0-10 = "0-10"
			 11-20 = "11-20"
			 21-30 =  "21-30"
             31-40 = "31-40"&lt;BR /&gt;             40-high = "41+"
			 . = "unknown";
RUN;&lt;/PRE&gt;&lt;P&gt;and the following proc tabulate:&lt;/P&gt;&lt;PRE&gt;PROC TABULATE;
	class group; 
	class age / preloadfmt missing;
	class residenceStatus;
	TABLE group, residenceStatus * age;
	FORMAT age agegrp.;
RUN;&lt;/PRE&gt;&lt;P&gt;How can I repeat all agegroups (0-10, 11-20, 21-30, unknown) for every residence status (A, B, C)?&lt;/P&gt;&lt;P&gt;I have experimented somewhat with "preloadfmt" but didn't get it to work properly. Thanks for help!&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 20:56:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Show-all-categories-even-with-no-cases-in-PROC-TABULATE/m-p/647612#M22171</guid>
      <dc:creator>dstuder</dc:creator>
      <dc:date>2020-05-13T20:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Show all categories (even with no cases) in PROC TABULATE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Show-all-categories-even-with-no-cases-in-PROC-TABULATE/m-p/647621#M22172</link>
      <description>&lt;P&gt;You have a typo in your format.&lt;/P&gt;
&lt;P&gt;To get PRELOADFMT to display values that do not appear in the data you need the PRINTMISS option in the table options:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;PROC FORMAT;
VALUE agegrp 0-10 = "0-10"
			    11-20 = "11-20"
			    21-30 =  "21-30"
             31-40 = "31-40"
             40-high = "41+"
			    . = "unknown";
RUN;

PROC TABULATE;
	class group; 
	class age / preloadfmt missing ;
	class residenceStatus;
	TABLE group, 
         residenceStatus * age
         /printmiss ;
	FORMAT age agegrp.;
RUN;&lt;/PRE&gt;
&lt;P&gt;sometimes you may want the ORDER=DATA on the class statement with the Preloadfmt as well. It can depend on the actual contents of your data.&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 20:50:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Show-all-categories-even-with-no-cases-in-PROC-TABULATE/m-p/647621#M22172</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-13T20:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Show all categories (even with no cases) in PROC TABULATE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Show-all-categories-even-with-no-cases-in-PROC-TABULATE/m-p/647627#M22174</link>
      <description>&lt;P&gt;When I ran your code (SAS On Demand) I get this error message in the log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; WARNING: PreloadFmt will have no effect on the output without one of the following options: "printmiss", "order=data", or the class 
          statement option "exclusive".&lt;/PRE&gt;
&lt;P&gt;I then added the printmiss statement to the TABLE statement and it works as expected. You can add misstext to have them show as 0 rather than a period.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	TABLE group, residenceStatus * age / printmiss misstext='0';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/324367"&gt;@dstuder&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello everybody!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the following sample data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;DATA offenders;
INPUT group :$1. age :3. residenceStatus :$1. sex :$1.;
INFILE DATALINES DSD;
DATALINES;
A,10,A,m
A,14,A,m
A,11,B,m
B,21,A,w
B,20,B,m
B,,B,m
B,34,C,m
A,60,C,w
;
RUN;

PROC FORMAT;
VALUE agegrp 0-10 = "0-10"
			 11-20 = "11-20"
			 21-30 =  "21-30"
             31-40 = "31-40"&lt;BR /&gt;             40-hight = "41+"
			 . = "unknown";
RUN;&lt;/PRE&gt;
&lt;P&gt;and the following proc tabulate:&lt;/P&gt;
&lt;PRE&gt;PROC TABULATE;
	class group; 
	class age / preloadfmt missing;
	class residenceStatus;
	TABLE group, residenceStatus * age;
	FORMAT age agegrp.;
RUN;&lt;/PRE&gt;
&lt;P&gt;How can I repeat all agegroups (0-10, 11-20, 21-30, unknown) for every residence status (A, B, C)?&lt;/P&gt;
&lt;P&gt;I have experimented somewhat with "preloadfmt" but didn't get it to work properly. Thanks for help!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 20:54:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Show-all-categories-even-with-no-cases-in-PROC-TABULATE/m-p/647627#M22174</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-05-13T20:54:48Z</dc:date>
    </item>
  </channel>
</rss>

