<?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: proc report - how to add counts to column header in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/proc-report-how-to-add-counts-to-column-header/m-p/439349#M20482</link>
    <description>&lt;P&gt;Hi:&lt;BR /&gt; This is very similar to the Demographic report shown in this Global Forum paper: &lt;A href="http://www2.sas.com/proceedings/forum2008/173-2008.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2008/173-2008.pdf&lt;/A&gt; starting on page 9. &lt;BR /&gt;&lt;BR /&gt;But conceptually, you can do something like this with macro variables.&lt;BR /&gt;&lt;BR /&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;** could create these macro variables in a program;
** instead of hardcoding the values;
%let agestr = (N=19);
%let htstr = (N=19);
%let wtstr = (N=19);

ods rtf file='c:\temp\showheader.rtf';

proc report data=sashelp.class split='*'  
   style(header)={background=white}
   style(column)={width=1in};
  column sex age height weight;
  define sex / group ' *Sex';
  define age / "Age*&amp;amp;agestr";
  define height / mean "Avg Height*&amp;amp;htstr" f=8.2;
  define weight / mean "Avg Weight*&amp;amp;wtstr" f=8.2;
run;
ods rtf close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;produces this using ODS RTF:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="put_n_header.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18760i686DBA7918611746/image-size/large?v=v2&amp;amp;px=999" role="button" title="put_n_header.png" alt="put_n_header.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;cynthia&lt;/P&gt;</description>
    <pubDate>Thu, 22 Feb 2018 16:31:41 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2018-02-22T16:31:41Z</dc:date>
    <item>
      <title>proc report - how to add counts to column header</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/proc-report-how-to-add-counts-to-column-header/m-p/439333#M20476</link>
      <description>&lt;P&gt;I would like&amp;nbsp;to produce a report table with column headings in two rows - the first row is regular column title, the second row is a count in the format of (n=xxx);&lt;/P&gt;&lt;P&gt;Also, have to include min-max range in first column.&amp;nbsp;Is there a way to do it using ods rtf proc report? Thanks for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Demographics&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;Treatment&lt;BR /&gt;&amp;nbsp; &amp;nbsp;(n= xx)&lt;/TD&gt;&lt;TD&gt;Placebo&lt;BR /&gt;(n= xx)&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Total&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;(n=xx)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Mean age&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;[min-max range]&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;TR&gt;&lt;TD&gt;Mean Calculated Body Weight (kg)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;[min-max range]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;</description>
      <pubDate>Thu, 22 Feb 2018 15:58:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/proc-report-how-to-add-counts-to-column-header/m-p/439333#M20476</guid>
      <dc:creator>SASPrime</dc:creator>
      <dc:date>2018-02-22T15:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc report - how to add counts to column header</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/proc-report-how-to-add-counts-to-column-header/m-p/439349#M20482</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt; This is very similar to the Demographic report shown in this Global Forum paper: &lt;A href="http://www2.sas.com/proceedings/forum2008/173-2008.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2008/173-2008.pdf&lt;/A&gt; starting on page 9. &lt;BR /&gt;&lt;BR /&gt;But conceptually, you can do something like this with macro variables.&lt;BR /&gt;&lt;BR /&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;** could create these macro variables in a program;
** instead of hardcoding the values;
%let agestr = (N=19);
%let htstr = (N=19);
%let wtstr = (N=19);

ods rtf file='c:\temp\showheader.rtf';

proc report data=sashelp.class split='*'  
   style(header)={background=white}
   style(column)={width=1in};
  column sex age height weight;
  define sex / group ' *Sex';
  define age / "Age*&amp;amp;agestr";
  define height / mean "Avg Height*&amp;amp;htstr" f=8.2;
  define weight / mean "Avg Weight*&amp;amp;wtstr" f=8.2;
run;
ods rtf close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;produces this using ODS RTF:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="put_n_header.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18760i686DBA7918611746/image-size/large?v=v2&amp;amp;px=999" role="button" title="put_n_header.png" alt="put_n_header.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 16:31:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/proc-report-how-to-add-counts-to-column-header/m-p/439349#M20482</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-02-22T16:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: proc report - how to add counts to column header</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/proc-report-how-to-add-counts-to-column-header/m-p/439392#M20485</link>
      <description>&lt;P&gt;As suggested, used macro variables, and it worked! Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 18:18:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/proc-report-how-to-add-counts-to-column-header/m-p/439392#M20485</guid>
      <dc:creator>SASPrime</dc:creator>
      <dc:date>2018-02-22T18:18:30Z</dc:date>
    </item>
  </channel>
</rss>

