<?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: Changing PROC REPORT DEFINE Labels across pages. in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Changing-PROC-REPORT-DEFINE-Labels-across-pages/m-p/652783#M24160</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19995"&gt;@SmithCJGVSU&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this particular case, an alternative to BY group processing could be the use of macro language.&lt;/P&gt;
&lt;P&gt;Maybe something like this:&lt;/P&gt;
&lt;P&gt;1 - definition of distinct macrovariables by group:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    /*Big N overall*/
    select trt01pn, count(distinct usubjid) into :trtn1-:trtn99,:bign1-:bign99
    from adsl
    group by trt01pn;
    /*Big N sexn=0*/
    select trt01pn, count(distinct usubjid) into :trtn_0_1-:trtn_0_99,:bign_0_1-:bign_0_99
    from adsl
    where sexn=0
    group by trt01pn;
    /*Big N sexn=1*/
    select trt01pn, count(distinct usubjid) into :trtn_1_1-:trtn_1_99,:bign_1_1-:bign_1_99
    from adsl
    where sexn=1
    group by trt01pn;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2 - Define a macro program with sex as a parameter (nb: you should also define the title accordingly, with values of sex as it is less efficient than BY group processing to do that automatically)&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;%macro report(sex=);

	proc report data=final missing split='|' ;
	    columns varord varlbl statord statlbl col:;
	    define varord /order order=internal noprint;
	    define varlbl /order order=internal noprint;
	    define statord /order order=internal noprint;    
	    define statlbl /display '' style(column)={cellwidth=2.21in} id;
	    define col1   /display style(column)={cellwidth=1in} "Placebo|(N=&amp;amp;&amp;amp;&amp;amp;bign_&amp;amp;sex._1)";
	    define col2   /display style(column)={cellwidth=1in} "Active 1|(N=&amp;amp;&amp;amp;&amp;amp;bign_&amp;amp;sex._2)";
	    define col3   /display style(column)={cellwidth=1in} "Active 2|(N=&amp;amp;&amp;amp;&amp;amp;bign_&amp;amp;sex._3)";
	run;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;3 - Macro call (one per group like below, or use of CALL EXECUTE)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%report (sex=0)
%report (sex=1)&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 03 Jun 2020 08:18:18 GMT</pubDate>
    <dc:creator>ed_sas_member</dc:creator>
    <dc:date>2020-06-03T08:18:18Z</dc:date>
    <item>
      <title>Changing PROC REPORT DEFINE Labels across pages.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Changing-PROC-REPORT-DEFINE-Labels-across-pages/m-p/652686#M24158</link>
      <description>&lt;P&gt;In pharmaceutical - clinical trial reporting, we often present Big N values in the PROC REPORT column headers.&amp;nbsp; To do this, we may opt to create macro variables and use them in the DEFINE statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
    /*Big N*/
    select trt01pn, count(distinct usubjid) into :trtn1-:trtn99,:bign1-:bign99
    from adsl
    group by trt01pn;    
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ODS TAGSETS.RTF &amp;lt;...&amp;gt;;
proc report data=final missing split='|' ;
    columns varord varlbl statord statlbl col:;
    define varord /order order=internal noprint;
    define varlbl /order order=internal noprint;
    define statord /order order=internal noprint;    
    define statlbl /display '' style(column)={cellwidth=2.21in} id;
    define col1   /display style(column)={cellwidth=1in} "Placebo|(N=&lt;STRONG&gt;&amp;amp;bign1&lt;/STRONG&gt;)";
    define col2   /display style(column)={cellwidth=1in} "Active 1|(N=&lt;STRONG&gt;&amp;amp;bign2&lt;/STRONG&gt;)";
    define col3   /display style(column)={cellwidth=1in} "Active 2|(N=&lt;STRONG&gt;&amp;amp;bign3&lt;/STRONG&gt;)";
    /* &amp;lt;other proc report statements&amp;gt; */
run;
ODS TAGSETS.RTF close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The difficulty though, is if we introduce By-Group processing (e.g. BY SEXN SEX;) and we want page 1 to reflect Males and page 2 to reflect Females, we would also want the Big N values to based on the subgroup.&amp;nbsp; So, Big N values can not be "hard-coded" via DEFINE label unless we do multiple PROC REPORT procedures.&amp;nbsp; I know we can't use #BYVAL in the DEFINE statement, but is there alternatives where we can change the BIG N values across pages WITHOUT doing multiple PROC REPORT procedures (i.e. one procedure per subgroup level)?&amp;nbsp; Note that, all the data are already summarized prior to PROC REPORT.&amp;nbsp; We are using REPORT as a glorified PROC PRINT.&amp;nbsp; See Screenshots below as an example.&amp;nbsp; The goal is to get the counts in the column header to pertain to the subgroup without doing the brute force method of multiple report procedures.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="6-2-2020 4-06-47 PM.png" style="width: 865px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/40283iAC00FAC7FACE8E07/image-size/large?v=v2&amp;amp;px=999" role="button" title="6-2-2020 4-06-47 PM.png" alt="6-2-2020 4-06-47 PM.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="6-2-2020 4-07-51 PM.png" style="width: 873px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/40284i8E2BA572499C63A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="6-2-2020 4-07-51 PM.png" alt="6-2-2020 4-07-51 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2020 21:34:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Changing-PROC-REPORT-DEFINE-Labels-across-pages/m-p/652686#M24158</guid>
      <dc:creator>SmithCJGVSU</dc:creator>
      <dc:date>2020-06-02T21:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Changing PROC REPORT DEFINE Labels across pages.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Changing-PROC-REPORT-DEFINE-Labels-across-pages/m-p/652783#M24160</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19995"&gt;@SmithCJGVSU&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this particular case, an alternative to BY group processing could be the use of macro language.&lt;/P&gt;
&lt;P&gt;Maybe something like this:&lt;/P&gt;
&lt;P&gt;1 - definition of distinct macrovariables by group:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    /*Big N overall*/
    select trt01pn, count(distinct usubjid) into :trtn1-:trtn99,:bign1-:bign99
    from adsl
    group by trt01pn;
    /*Big N sexn=0*/
    select trt01pn, count(distinct usubjid) into :trtn_0_1-:trtn_0_99,:bign_0_1-:bign_0_99
    from adsl
    where sexn=0
    group by trt01pn;
    /*Big N sexn=1*/
    select trt01pn, count(distinct usubjid) into :trtn_1_1-:trtn_1_99,:bign_1_1-:bign_1_99
    from adsl
    where sexn=1
    group by trt01pn;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2 - Define a macro program with sex as a parameter (nb: you should also define the title accordingly, with values of sex as it is less efficient than BY group processing to do that automatically)&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;%macro report(sex=);

	proc report data=final missing split='|' ;
	    columns varord varlbl statord statlbl col:;
	    define varord /order order=internal noprint;
	    define varlbl /order order=internal noprint;
	    define statord /order order=internal noprint;    
	    define statlbl /display '' style(column)={cellwidth=2.21in} id;
	    define col1   /display style(column)={cellwidth=1in} "Placebo|(N=&amp;amp;&amp;amp;&amp;amp;bign_&amp;amp;sex._1)";
	    define col2   /display style(column)={cellwidth=1in} "Active 1|(N=&amp;amp;&amp;amp;&amp;amp;bign_&amp;amp;sex._2)";
	    define col3   /display style(column)={cellwidth=1in} "Active 2|(N=&amp;amp;&amp;amp;&amp;amp;bign_&amp;amp;sex._3)";
	run;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;3 - Macro call (one per group like below, or use of CALL EXECUTE)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%report (sex=0)
%report (sex=1)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jun 2020 08:18:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Changing-PROC-REPORT-DEFINE-Labels-across-pages/m-p/652783#M24160</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-06-03T08:18:18Z</dc:date>
    </item>
  </channel>
</rss>

