<?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: Report with multiple frequencies for the same variable with different formats in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Report-with-multiple-frequencies-for-the-same-variable-with/m-p/443040#M20597</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/374"&gt;@AYBiBTU&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;That will not work in my real situation as I am using pre-compiled formats from a external format library.&amp;nbsp; It also would not have the desired result for the final frequency column.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I suspect that you are going to have issues with most approaches as long as your formats use other='NOT APPLICABLE' as then missing values will have 'NOT APPLICABLE' regardless of the setting of the missing option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This creates a table that looks like your desired output for content though not column headings and does require creating additional variables.&lt;/P&gt;
&lt;PRE&gt;data have;
input foo @@;
cards;
1 2 3 4 5 1 3 1 3 5 5 5
;
run;
proc format LIBRARY=WORK;
    value wide (default=20)
	   1     = 'VERY SATISFIED'
		2     = 'SATISFIED'
		3     = 'DISSATISFIED'
		4     = 'VERY DISSATISFIED'
		5-high = 'NOT APPLICABLE';

    value thin (default=20)
	   1, 2  = 'SATISFIED'
		3, 4  = 'DISSATISFIED'
		5-high = 'NOT APPLICABLE';
run;
proc summary data=have nway;
   class foo;
   var foo;
   format foo wide.;
   output out=sum1 (drop= _: ) n=foon;
run;
proc summary data=have nway;
   class foo;
   var foo;
   format foo thin.;
   output out=sum2(drop= _: ) n=foon2;
run;
options missing=' ';
proc sql;
   create table want as
   select a.foo format=f1., put(a.foo,wide.) as foow,foon,put(b.foo,thin.) as foot,b.foon2
   from sum1 as a
        left join
        sum2 as b
        on a.foo = b.foo
  ;
quit;
&lt;/PRE&gt;
&lt;P&gt;So you may want to discuss the use of "other" with the external format library manager.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Mar 2018 20:53:55 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-03-06T20:53:55Z</dc:date>
    <item>
      <title>Report with multiple frequencies for the same variable with different formats</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Report-with-multiple-frequencies-for-the-same-variable-with/m-p/442964#M20592</link>
      <description>&lt;P&gt;I have the example code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input foo @@;
cards;
1 2 3 4 5 1 3 1 3 5 5 5
;
run;

proc format;
    value wide (default=20)
	    1     = 'VERY SATISFIED'
		2     = 'SATISFIED'
		3     = 'DISSATISFIED'
		4     = 'VERY DISSATISFIED'
		other = 'NOT APPLICABLE';

    value thin (default=20)
	    1, 2  = 'SATISFIED'
		3, 4  = 'DISSATISFIED'
		other = 'NOT APPLICABLE';
run;

options missing=' ';
proc report data=have nowd spanrows out=foo;
columns foo=ord foo=cnt foo=bar(n) foo=baz(n);
define ord / group order=internal;
define cnt / analysis n noprint;
define bar / group format=wide.;
define baz / group format=thin.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which produces output like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Report: Detailed and/or summarized report" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;&lt;COLGROUP&gt;&lt;COL /&gt;&lt;COL /&gt;&lt;COL /&gt;&lt;COL /&gt;&lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH id="ch75b1cx1a" class="c header" scope="col"&gt;foo&lt;/TH&gt;
&lt;TH id="ch75b1cx3c" class="c header" scope="col"&gt;foo&lt;/TH&gt;
&lt;TH id="ch75b1cx4d" class="c header" scope="col"&gt;n&lt;/TH&gt;
&lt;TH id="ch75b1cx5e" class="c header" scope="col"&gt;foo&lt;/TH&gt;
&lt;TH id="ch75b1cx6f" class="c header" scope="col"&gt;n&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH id="rh75b1cx1" class="r data"&gt;1&lt;/TH&gt;
&lt;TH id="rh75b1cx2" class="r data"&gt;VERY SATISFIED&lt;/TH&gt;
&lt;TD class="r data"&gt;3&lt;/TD&gt;
&lt;TH id="rh75b1cx3" class="r data"&gt;SATISFIED&lt;/TH&gt;
&lt;TD class="r data"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH id="rh75b1cx4" class="r data"&gt;2&lt;/TH&gt;
&lt;TH id="rh75b1cx5" class="r data"&gt;SATISFIED&lt;/TH&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TH id="rh75b1cx6" class="r data"&gt;SATISFIED&lt;/TH&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH id="rh75b1cx7" class="r data"&gt;3&lt;/TH&gt;
&lt;TH id="rh75b1cx8" class="r data"&gt;DISSATISFIED&lt;/TH&gt;
&lt;TD class="r data"&gt;3&lt;/TD&gt;
&lt;TH id="rh75b1cx9" class="r data"&gt;DISSATISFIED&lt;/TH&gt;
&lt;TD class="r data"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH id="rh75b1cx10" class="r data"&gt;4&lt;/TH&gt;
&lt;TH id="rh75b1cx11" class="r data"&gt;VERY DISSATISFIED&lt;/TH&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TH id="rh75b1cx12" class="r data"&gt;DISSATISFIED&lt;/TH&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH id="rh75b1cx13" class="r data"&gt;5&lt;/TH&gt;
&lt;TH id="rh75b1cx14" class="r data"&gt;NOT APPLICABLE&lt;/TH&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;TH id="rh75b1cx15" class="r data"&gt;NOT APPLICABLE&lt;/TH&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="branch"&gt;
&lt;P style="page-break-after: always;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="page-break-after: always;"&gt;How instead to I get results like the following?&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Report: Detailed and/or summarized report" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;&lt;COLGROUP&gt;&lt;COL /&gt;&lt;COL /&gt;&lt;COL /&gt;&lt;COL /&gt;&lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH id="ch75b1cx1a" class="c header" scope="col"&gt;foo&lt;/TH&gt;
&lt;TH id="ch75b1cx3c" class="c header" scope="col"&gt;foo&lt;/TH&gt;
&lt;TH id="ch75b1cx4d" class="c header" scope="col"&gt;n&lt;/TH&gt;
&lt;TH id="ch75b1cx5e" class="c header" scope="col"&gt;foo&lt;/TH&gt;
&lt;TH id="ch75b1cx6f" class="c header" scope="col"&gt;n&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH id="rh75b1cx1" class="r data"&gt;1&lt;/TH&gt;
&lt;TH id="rh75b1cx2" class="r data"&gt;VERY SATISFIED&lt;/TH&gt;
&lt;TD class="r data"&gt;3&lt;/TD&gt;
&lt;TH id="rh75b1cx3" class="r data"&gt;SATISFIED&lt;/TH&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH id="rh75b1cx4" class="r data"&gt;2&lt;/TH&gt;
&lt;TH id="rh75b1cx5" class="r data"&gt;SATISFIED&lt;/TH&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TH id="rh75b1cx6" class="r data"&gt;&amp;nbsp;&lt;/TH&gt;
&lt;TD class="r data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH id="rh75b1cx7" class="r data"&gt;3&lt;/TH&gt;
&lt;TH id="rh75b1cx8" class="r data"&gt;DISSATISFIED&lt;/TH&gt;
&lt;TD class="r data"&gt;3&lt;/TD&gt;
&lt;TH id="rh75b1cx9" class="r data"&gt;DISSATISFIED&lt;/TH&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH id="rh75b1cx10" class="r data"&gt;4&lt;/TH&gt;
&lt;TH id="rh75b1cx11" class="r data"&gt;VERY DISSATISFIED&lt;/TH&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TH id="rh75b1cx12" class="r data"&gt;&amp;nbsp;&lt;/TH&gt;
&lt;TD class="r data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH id="rh75b1cx13" class="r data"&gt;5&lt;/TH&gt;
&lt;TH id="rh75b1cx14" class="r data"&gt;NOT APPLICABLE&lt;/TH&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;TH id="rh75b1cx15" class="r data"&gt;NOT APPLICABLE&lt;/TH&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 06 Mar 2018 16:51:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Report-with-multiple-frequencies-for-the-same-variable-with/m-p/442964#M20592</guid>
      <dc:creator>AYBiBTU</dc:creator>
      <dc:date>2018-03-06T16:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Report with multiple frequencies for the same variable with different formats</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Report-with-multiple-frequencies-for-the-same-variable-with/m-p/443007#M20595</link>
      <description>&lt;P&gt;What happens if you cheat it and try to duck the issue with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    value thin (default=20)
	        1     = 'VERY SATISFIED'
		2     = ' '
		3     = 'DISSATISFIED'
		4     = ' '
		other = 'NOT APPLICABLE';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;??&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 19:00:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Report-with-multiple-frequencies-for-the-same-variable-with/m-p/443007#M20595</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2018-03-06T19:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: Report with multiple frequencies for the same variable with different formats</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Report-with-multiple-frequencies-for-the-same-variable-with/m-p/443028#M20596</link>
      <description>&lt;P&gt;That will not work in my real situation as I am using pre-compiled formats from a external format library.&amp;nbsp; It also would not have the desired result for the final frequency column.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 20:30:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Report-with-multiple-frequencies-for-the-same-variable-with/m-p/443028#M20596</guid>
      <dc:creator>AYBiBTU</dc:creator>
      <dc:date>2018-03-06T20:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Report with multiple frequencies for the same variable with different formats</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Report-with-multiple-frequencies-for-the-same-variable-with/m-p/443040#M20597</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/374"&gt;@AYBiBTU&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;That will not work in my real situation as I am using pre-compiled formats from a external format library.&amp;nbsp; It also would not have the desired result for the final frequency column.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I suspect that you are going to have issues with most approaches as long as your formats use other='NOT APPLICABLE' as then missing values will have 'NOT APPLICABLE' regardless of the setting of the missing option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This creates a table that looks like your desired output for content though not column headings and does require creating additional variables.&lt;/P&gt;
&lt;PRE&gt;data have;
input foo @@;
cards;
1 2 3 4 5 1 3 1 3 5 5 5
;
run;
proc format LIBRARY=WORK;
    value wide (default=20)
	   1     = 'VERY SATISFIED'
		2     = 'SATISFIED'
		3     = 'DISSATISFIED'
		4     = 'VERY DISSATISFIED'
		5-high = 'NOT APPLICABLE';

    value thin (default=20)
	   1, 2  = 'SATISFIED'
		3, 4  = 'DISSATISFIED'
		5-high = 'NOT APPLICABLE';
run;
proc summary data=have nway;
   class foo;
   var foo;
   format foo wide.;
   output out=sum1 (drop= _: ) n=foon;
run;
proc summary data=have nway;
   class foo;
   var foo;
   format foo thin.;
   output out=sum2(drop= _: ) n=foon2;
run;
options missing=' ';
proc sql;
   create table want as
   select a.foo format=f1., put(a.foo,wide.) as foow,foon,put(b.foo,thin.) as foot,b.foon2
   from sum1 as a
        left join
        sum2 as b
        on a.foo = b.foo
  ;
quit;
&lt;/PRE&gt;
&lt;P&gt;So you may want to discuss the use of "other" with the external format library manager.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 20:53:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Report-with-multiple-frequencies-for-the-same-variable-with/m-p/443040#M20597</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-06T20:53:55Z</dc:date>
    </item>
  </channel>
</rss>

