<?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: Why the class statement in Proc Tabulate mess the code? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-the-class-statement-in-Proc-Tabulate-mess-the-code/m-p/812210#M320444</link>
    <description>How is it messing it up? Maybe I'm missing it, but don't see any explanation of what's happening that's unexpected.&lt;BR /&gt;&lt;BR /&gt;In general though CLASS statements only really affect if you have missing data. In that case, usually all missing are excluded. If that's what's happening, you need to either split the code up, one for each variable OR add the MISSING option to your CLASS statement so missing values are included OR (my recommendation) transpose your data so that the Question Number is a variable and responses are a different variable. Then you can use a single CLASS statement on that QUESTION and your code is also much simplified. This is usually now I code my summaries. &lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 09 May 2022 16:37:36 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2022-05-09T16:37:36Z</dc:date>
    <item>
      <title>Why the class statement in Proc Tabulate mess the code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-the-class-statement-in-Proc-Tabulate-mess-the-code/m-p/812204#M320442</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a set of 17 variables from a survey.&lt;/P&gt;&lt;P&gt;I am running some tests, so I did a simple proc freq:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc freq data=sw1;
table Q20_1;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And I get this result:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Q20_1&lt;/TD&gt;&lt;TD&gt;Frequency&lt;/TD&gt;&lt;TD&gt;Percent&lt;/TD&gt;&lt;TD&gt;CumulativeFrequency&lt;/TD&gt;&lt;TD&gt;CumulativePercent&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;74&lt;/TD&gt;&lt;TD&gt;21.02&lt;/TD&gt;&lt;TD&gt;74&lt;/TD&gt;&lt;TD&gt;21.02&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;126&lt;/TD&gt;&lt;TD&gt;35.80&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;56.82&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;113&lt;/TD&gt;&lt;TD&gt;32.10&lt;/TD&gt;&lt;TD&gt;313&lt;/TD&gt;&lt;TD&gt;88.92&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;39&lt;/TD&gt;&lt;TD&gt;11.08&lt;/TD&gt;&lt;TD&gt;352&lt;/TD&gt;&lt;TD&gt;100.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Frequency Missing = 668&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I tried a proc tabulate because I needed to do further analysis with the data, and everything when alright:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc tabulate data=sw1;
class Q20_1;
table (n='Count'*f=7. pctn&amp;lt;Q20_1&amp;gt;='Test1'*f=pctfmt9.2),Q20_1;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Results are the same but transposed, and that's ok.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, when I added the rest of the variables to the code to start getting the tables, the results were messed up.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc tabulate data=sw1;
class Q20_1 Q20_2 Q20_3 Q20_4 Q20_5 Q20_6 Q20_7 Q20_8 Q20_9 Q20_10 Q20_11 Q20_12 Q20_13 Q20_14 Q20_15 Q20_16 Q20_17;
table (n='Count'*f=7. pctn&amp;lt;Q20_1&amp;gt;='Test1'*f=pctfmt9.2),Q20_1;
table (pctn&amp;lt;q20_2&amp;gt;='Test2'*f=pctfmt9.2),q20_2;
table (pctn&amp;lt;q20_3&amp;gt;='Test3'*f=pctfmt9.2),q20_3;
table (pctn&amp;lt;q20_4&amp;gt;='Test4'*f=pctfmt9.2),q20_4;
table (pctn&amp;lt;q20_5&amp;gt;='Test5'*f=pctfmt9.2),q20_5;
table (pctn&amp;lt;q20_6&amp;gt;='Test6'*f=pctfmt9.2),q20_6;
table (pctn&amp;lt;q20_7&amp;gt;='Test7'*f=pctfmt9.2),q20_7;
table (pctn&amp;lt;q20_8&amp;gt;='Test8'*f=pctfmt9.2),q20_8;
table (pctn&amp;lt;q20_9&amp;gt;='Test9'*f=pctfmt9.2),q20_9;
table (pctn&amp;lt;q20_10&amp;gt;='Test10'*f=pctfmt9.2),q20_10;
table (pctn&amp;lt;q20_11&amp;gt;='Test11'*f=pctfmt9.2),q20_11;
table (pctn&amp;lt;q20_12&amp;gt;='Test12'*f=pctfmt9.2),q20_12;
table (pctn&amp;lt;q20_13&amp;gt;='Test13'*f=pctfmt9.2),q20_13;
table (pctn&amp;lt;q20_14&amp;gt;='Test14'*f=pctfmt9.2),q20_14;
table (pctn&amp;lt;q20_15&amp;gt;='Test15'*f=pctfmt9.2),q20_15;
table (pctn&amp;lt;q20_16&amp;gt;='Test16'*f=pctfmt9.2),q20_16;
table (pctn&amp;lt;q20_17&amp;gt;='Test17'*f=pctfmt9.2),q20_17;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Output for test1:&lt;/P&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Q20_1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Test1&lt;/TD&gt;&lt;TD&gt;50.00&lt;/TD&gt;&lt;TD&gt;16.67&lt;/TD&gt;&lt;TD&gt;33.33&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why is this "big" class statement affecting another statement where I am not calling the rest of the variables?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your time, and I appreciate your help.&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SAS EG 7.12 (7.100.2.3350) (64-bit)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 16:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-the-class-statement-in-Proc-Tabulate-mess-the-code/m-p/812204#M320442</guid>
      <dc:creator>Scorpx</dc:creator>
      <dc:date>2022-05-09T16:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Why the class statement in Proc Tabulate mess the code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-the-class-statement-in-Proc-Tabulate-mess-the-code/m-p/812210#M320444</link>
      <description>How is it messing it up? Maybe I'm missing it, but don't see any explanation of what's happening that's unexpected.&lt;BR /&gt;&lt;BR /&gt;In general though CLASS statements only really affect if you have missing data. In that case, usually all missing are excluded. If that's what's happening, you need to either split the code up, one for each variable OR add the MISSING option to your CLASS statement so missing values are included OR (my recommendation) transpose your data so that the Question Number is a variable and responses are a different variable. Then you can use a single CLASS statement on that QUESTION and your code is also much simplified. This is usually now I code my summaries. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 09 May 2022 16:37:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-the-class-statement-in-Proc-Tabulate-mess-the-code/m-p/812210#M320444</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-05-09T16:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Why the class statement in Proc Tabulate mess the code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-the-class-statement-in-Proc-Tabulate-mess-the-code/m-p/812211#M320445</link>
      <description>&lt;P&gt;This may also get you what you want:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*Run frequency for tables;
ods table onewayfreqs=temp;
proc freq data=sw1;
	table Q20_1 - Q20_17 / missing;
run;

*Format output;
data want;
length variable $32. variable_value $50.;
set temp;
Variable=scan(table, 2);

Variable_Value=strip(trim(vvaluex(variable)));

keep variable variable_value frequency percent cum:;
label variable='Variable' 
	variable_value='Variable Value';
run;

*Display;
proc print data=want(obs=20) label;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247746"&gt;@Scorpx&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a set of 17 variables from a survey.&lt;/P&gt;
&lt;P&gt;I am running some tests, so I did a simple proc freq:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;proc freq data=sw1;
table Q20_1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And I get this result:&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp;
&lt;TABLE cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;Q20_1&lt;/TD&gt;
&lt;TD&gt;Frequency&lt;/TD&gt;
&lt;TD&gt;Percent&lt;/TD&gt;
&lt;TD&gt;CumulativeFrequency&lt;/TD&gt;
&lt;TD&gt;CumulativePercent&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;74&lt;/TD&gt;
&lt;TD&gt;21.02&lt;/TD&gt;
&lt;TD&gt;74&lt;/TD&gt;
&lt;TD&gt;21.02&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;126&lt;/TD&gt;
&lt;TD&gt;35.80&lt;/TD&gt;
&lt;TD&gt;200&lt;/TD&gt;
&lt;TD&gt;56.82&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;113&lt;/TD&gt;
&lt;TD&gt;32.10&lt;/TD&gt;
&lt;TD&gt;313&lt;/TD&gt;
&lt;TD&gt;88.92&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;39&lt;/TD&gt;
&lt;TD&gt;11.08&lt;/TD&gt;
&lt;TD&gt;352&lt;/TD&gt;
&lt;TD&gt;100.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Frequency Missing = 668&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then I tried a proc tabulate because I needed to do further analysis with the data, and everything when alright:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;proc tabulate data=sw1;
class Q20_1;
table (n='Count'*f=7. pctn&amp;lt;Q20_1&amp;gt;='Test1'*f=pctfmt9.2),Q20_1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results are the same but transposed, and that's ok.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, when I added the rest of the variables to the code to start getting the tables, the results were messed up.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;proc tabulate data=sw1;
class Q20_1 Q20_2 Q20_3 Q20_4 Q20_5 Q20_6 Q20_7 Q20_8 Q20_9 Q20_10 Q20_11 Q20_12 Q20_13 Q20_14 Q20_15 Q20_16 Q20_17;
table (n='Count'*f=7. pctn&amp;lt;Q20_1&amp;gt;='Test1'*f=pctfmt9.2),Q20_1;
table (pctn&amp;lt;q20_2&amp;gt;='Test2'*f=pctfmt9.2),q20_2;
table (pctn&amp;lt;q20_3&amp;gt;='Test3'*f=pctfmt9.2),q20_3;
table (pctn&amp;lt;q20_4&amp;gt;='Test4'*f=pctfmt9.2),q20_4;
table (pctn&amp;lt;q20_5&amp;gt;='Test5'*f=pctfmt9.2),q20_5;
table (pctn&amp;lt;q20_6&amp;gt;='Test6'*f=pctfmt9.2),q20_6;
table (pctn&amp;lt;q20_7&amp;gt;='Test7'*f=pctfmt9.2),q20_7;
table (pctn&amp;lt;q20_8&amp;gt;='Test8'*f=pctfmt9.2),q20_8;
table (pctn&amp;lt;q20_9&amp;gt;='Test9'*f=pctfmt9.2),q20_9;
table (pctn&amp;lt;q20_10&amp;gt;='Test10'*f=pctfmt9.2),q20_10;
table (pctn&amp;lt;q20_11&amp;gt;='Test11'*f=pctfmt9.2),q20_11;
table (pctn&amp;lt;q20_12&amp;gt;='Test12'*f=pctfmt9.2),q20_12;
table (pctn&amp;lt;q20_13&amp;gt;='Test13'*f=pctfmt9.2),q20_13;
table (pctn&amp;lt;q20_14&amp;gt;='Test14'*f=pctfmt9.2),q20_14;
table (pctn&amp;lt;q20_15&amp;gt;='Test15'*f=pctfmt9.2),q20_15;
table (pctn&amp;lt;q20_16&amp;gt;='Test16'*f=pctfmt9.2),q20_16;
table (pctn&amp;lt;q20_17&amp;gt;='Test17'*f=pctfmt9.2),q20_17;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output for test1:&lt;/P&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;TABLE cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;Q20_1&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Count&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Test1&lt;/TD&gt;
&lt;TD&gt;50.00&lt;/TD&gt;
&lt;TD&gt;16.67&lt;/TD&gt;
&lt;TD&gt;33.33&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why is this "big" class statement affecting another statement where I am not calling the rest of the variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your time, and I appreciate your help.&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SAS EG 7.12 (7.100.2.3350) (64-bit)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 16:39:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-the-class-statement-in-Proc-Tabulate-mess-the-code/m-p/812211#M320445</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-05-09T16:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Why the class statement in Proc Tabulate mess the code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-the-class-statement-in-Proc-Tabulate-mess-the-code/m-p/812223#M320449</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, the /missing partially solved the issue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But as you know,/missing makes SAS count missing values in the calculation. So now, my percentages are not correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will try to clarify further:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Without /missing and only one variable in the class statement:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc tabulate data=sw1;
class Q20_1;
table (n='Count'*f=7. pctn&amp;lt;Q20_1&amp;gt;='Test1'*f=pctfmt9.2),Q20_1;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I got this:&lt;/P&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Q20_1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;TD&gt;74&lt;/TD&gt;&lt;TD&gt;126&lt;/TD&gt;&lt;TD&gt;113&lt;/TD&gt;&lt;TD&gt;39&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Test 1&lt;/TD&gt;&lt;TD&gt;21.02&lt;/TD&gt;&lt;TD&gt;35.80&lt;/TD&gt;&lt;TD&gt;32.10&lt;/TD&gt;&lt;TD&gt;11.08&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With several variables in the class statement without /missing:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc tabulate data=sw1;
class Q20_1 Q20_2 Q20_3 Q20_4 Q20_5 Q20_6 Q20_7 Q20_8 Q20_9 Q20_10 Q20_11 Q20_12 Q20_13 Q20_14 Q20_15 Q20_16 Q20_17;
table (n='Count'*f=7. pctn&amp;lt;Q20_1&amp;gt;='Test1'*f=pctfmt9.2),Q20_1;
table (pctn&amp;lt;q20_2&amp;gt;='Test2'*f=pctfmt9.2),q20_2;
table (pctn&amp;lt;q20_3&amp;gt;='Test3'*f=pctfmt9.2),q20_3;
table (pctn&amp;lt;q20_4&amp;gt;='Test4'*f=pctfmt9.2),q20_4;
table (pctn&amp;lt;q20_5&amp;gt;='Test5'*f=pctfmt9.2),q20_5;
table (pctn&amp;lt;q20_6&amp;gt;='Test6'*f=pctfmt9.2),q20_6;
table (pctn&amp;lt;q20_7&amp;gt;='Test7'*f=pctfmt9.2),q20_7;
table (pctn&amp;lt;q20_8&amp;gt;='Test8'*f=pctfmt9.2),q20_8;
table (pctn&amp;lt;q20_9&amp;gt;='Test9'*f=pctfmt9.2),q20_9;
table (pctn&amp;lt;q20_10&amp;gt;='Test10'*f=pctfmt9.2),q20_10;
table (pctn&amp;lt;q20_11&amp;gt;='Test11'*f=pctfmt9.2),q20_11;
table (pctn&amp;lt;q20_12&amp;gt;='Test12'*f=pctfmt9.2),q20_12;
table (pctn&amp;lt;q20_13&amp;gt;='Test13'*f=pctfmt9.2),q20_13;
table (pctn&amp;lt;q20_14&amp;gt;='Test14'*f=pctfmt9.2),q20_14;
table (pctn&amp;lt;q20_15&amp;gt;='Test15'*f=pctfmt9.2),q20_15;
table (pctn&amp;lt;q20_16&amp;gt;='Test16'*f=pctfmt9.2),q20_16;
table (pctn&amp;lt;q20_17&amp;gt;='Test17'*f=pctfmt9.2),q20_17;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got this:&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Q20_1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Test1&lt;/TD&gt;&lt;TD&gt;50.00&lt;/TD&gt;&lt;TD&gt;16.67&lt;/TD&gt;&lt;TD&gt;33.33&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I added the /missing to the class statement, returning the output to "normal." But the percentages are incorrect (because I don't want it to count the missing values).&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Q20_1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;TD&gt;668&lt;/TD&gt;&lt;TD&gt;74&lt;/TD&gt;&lt;TD&gt;126&lt;/TD&gt;&lt;TD&gt;113&lt;/TD&gt;&lt;TD&gt;39&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Test1&lt;/TD&gt;&lt;TD&gt;65.49&lt;/TD&gt;&lt;TD&gt;7.25&lt;/TD&gt;&lt;TD&gt;12.35&lt;/TD&gt;&lt;TD&gt;11.08&lt;/TD&gt;&lt;TD&gt;3.82&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS:&amp;nbsp;I don't know if I am working double, but I do the transpose AFTER I get the proc tabulate results&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 17:36:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-the-class-statement-in-Proc-Tabulate-mess-the-code/m-p/812223#M320449</guid>
      <dc:creator>Scorpx</dc:creator>
      <dc:date>2022-05-09T17:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why the class statement in Proc Tabulate mess the code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-the-class-statement-in-Proc-Tabulate-mess-the-code/m-p/812230#M320451</link>
      <description>Transpose before you get the PROC TABULATE results. &lt;BR /&gt;&lt;BR /&gt;When you have missing values in CLASS statements that row will get excluded from all values, which means your values will be wrong. &lt;BR /&gt;&lt;BR /&gt;So as stated you have two options - either call proc tabulate for each variable alone. &lt;BR /&gt;Or transpose and then do a proc tabulate. Since you're proc transposing after, this is the better option but you should also check the PROC FREQ code I posted which could help you avoid this all together.</description>
      <pubDate>Mon, 09 May 2022 17:49:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-the-class-statement-in-Proc-Tabulate-mess-the-code/m-p/812230#M320451</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-05-09T17:49:46Z</dc:date>
    </item>
  </channel>
</rss>

