<?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: Using #BYVAL in titles with ODS LAYOUT GRIDDED and by-group processing in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-BYVAL-in-titles-with-ODS-LAYOUT-GRIDDED-and-by-group/m-p/953981#M26791</link>
    <description>&lt;P&gt;Make the "title" part of the report.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Example 2: Customize the by-group titles, and it fails;
title;
options nobyline;
ods layout gridded columns=3 advance=bygroup;
proc report data=sashelp.iris;
    by species;
    columns species sepal:;
    define species / group noprint;
    define sepal: / mean;
    break after species / page;
    compute before _page_ ;
      line 'Species: ' species $20.;
    endcomp;
run;
ods layout end;
options byline;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 18 Dec 2024 13:27:34 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2024-12-18T13:27:34Z</dc:date>
    <item>
      <title>Using #BYVAL in titles with ODS LAYOUT GRIDDED and by-group processing</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-BYVAL-in-titles-with-ODS-LAYOUT-GRIDDED-and-by-group/m-p/953936#M26790</link>
      <description>&lt;P&gt;I want to print many tables, arranged in 3 columns. To control the layout, I'm using ODS LAYOUT GRIDDED. The data for the tables are in one dataset, so I'm&amp;nbsp; only calling PROC REPORT once with a BY statement. My issue is how to customize the title of each table. If I let SAS handle the titles for me, then everything's fine:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;* Example 1: Let SAS handle the by-group titles, and it works great;&lt;BR /&gt;title;
ods layout gridded columns=3 advance=bygroup;
proc report data=sashelp.iris;&lt;BR /&gt;    by species;&lt;BR /&gt;    columns sepal:;&lt;BR /&gt;    define sepal: / mean;&lt;BR /&gt;run;&lt;BR /&gt;ods layout end;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screenshot - Letting SAS handle by-group titles.png" style="width: 757px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103125iD9DB2D04AE823E4F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot - Letting SAS handle by-group titles.png" alt="Screenshot - Letting SAS handle by-group titles.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You see that each little table is correctly labeled with its by-group. The problem arises when I try to customize the titles using the #BYVAL syntax -- then only the first table (from the first by-group) is given a title:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;* Example 2: Customize the by-group titles, and it fails;&lt;BR /&gt;title;
options nobyline;
ods layout gridded columns=3 advance=bygroup;
proc report data=sashelp.iris;&lt;BR /&gt;title 'Species: #byval1';&lt;BR /&gt;    by species;&lt;BR /&gt;    columns sepal:;&lt;BR /&gt;    define sepal: / mean;&lt;BR /&gt;run;
ods layout end;
options byline;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screenshot - Customizing by-group titles.png" style="width: 756px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103126iD0E7716CED8C4932/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot - Customizing by-group titles.png" alt="Screenshot - Customizing by-group titles.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can I title all the tables? If you comment out the ODS LAYOUT lines from my "Example 2" code above, you'd see that my custom titles work fine. So the problem is specifically in the interaction between using ODS LAYOUT and #BYVAL.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that a very similar question has already been asked (&lt;A href="https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-automatically-specify-a-different-title-for-each-graph/td-p/533130" target="_blank"&gt;https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-automatically-specify-a-different-title-for-each-graph/td-p/533130&lt;/A&gt;),&amp;nbsp;but in that case the solution was to change some settings in SAS Enterprise Guide. I'm using PC SAS&amp;nbsp;9.4 (TS1M8), so I think that solution is not relevant for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also know there are workarounds, e.g., I could wrap PROC REPORT in a macro and then use CALL EXECUTE to call the macro for each by-group. Then I could customize the by-group titles without using #BYVAL:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;* Example 3: Workaround using CALL EXECUTE -- gives me exactly what I want;
%macro print(species);
proc report data=sashelp.iris;
    title "Species: &amp;amp;species";
    where species = "&amp;amp;species";
    columns sepal:;
    define sepal: / mean;
run;
%mend;

title;
ods layout gridded columns=3 advance=table;
data _null_;&lt;BR /&gt;    set sashelp.iris;&lt;BR /&gt;    by species;&lt;BR /&gt;    if first.species then call execute('%print(' || trim(species) || ')');&lt;BR /&gt;run;
ods layout end;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screenshot - Using CALL EXECUTE to customize titles.png" style="width: 751px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103128i5C4201652A7861D2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot - Using CALL EXECUTE to customize titles.png" alt="Screenshot - Using CALL EXECUTE to customize titles.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So the workaround works, and that's fine if necessary. But, is there a simpler way, i.e., a simple modification to my "Example 2" code?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 23:49:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-BYVAL-in-titles-with-ODS-LAYOUT-GRIDDED-and-by-group/m-p/953936#M26790</guid>
      <dc:creator>dmuenz</dc:creator>
      <dc:date>2024-12-17T23:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using #BYVAL in titles with ODS LAYOUT GRIDDED and by-group processing</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-BYVAL-in-titles-with-ODS-LAYOUT-GRIDDED-and-by-group/m-p/953981#M26791</link>
      <description>&lt;P&gt;Make the "title" part of the report.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Example 2: Customize the by-group titles, and it fails;
title;
options nobyline;
ods layout gridded columns=3 advance=bygroup;
proc report data=sashelp.iris;
    by species;
    columns species sepal:;
    define species / group noprint;
    define sepal: / mean;
    break after species / page;
    compute before _page_ ;
      line 'Species: ' species $20.;
    endcomp;
run;
ods layout end;
options byline;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Dec 2024 13:27:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-BYVAL-in-titles-with-ODS-LAYOUT-GRIDDED-and-by-group/m-p/953981#M26791</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-12-18T13:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using #BYVAL in titles with ODS LAYOUT GRIDDED and by-group processing</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-BYVAL-in-titles-with-ODS-LAYOUT-GRIDDED-and-by-group/m-p/954063#M26793</link>
      <description>&lt;P&gt;Great idea, Tom! I like your solution and will accept it, though I still wonder (mostly out of curiosity) if there's a way to make this work using a TITLE statement.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 18:09:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-BYVAL-in-titles-with-ODS-LAYOUT-GRIDDED-and-by-group/m-p/954063#M26793</guid>
      <dc:creator>dmuenz</dc:creator>
      <dc:date>2024-12-18T18:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using #BYVAL in titles with ODS LAYOUT GRIDDED and by-group processing</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-BYVAL-in-titles-with-ODS-LAYOUT-GRIDDED-and-by-group/m-p/954122#M26796</link>
      <description>&lt;P&gt;I like the idea proposed by Tom, using 'compute before _page_'+'line ' to replace title statment,&lt;/P&gt;
&lt;P&gt;to make line statement look more like title, try this one :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title;
options nobyline;
ods layout gridded columns=3 advance=bygroup;
proc report data=sashelp.iris nowd style(report)={frame=void} 
style(column header)={borderwidth=2px bordertopwidth=2px};
    by species;
    columns species sepal:;
    define species / group noprint;
    define sepal: / mean;
    break after species / page;
    compute before _page_/style={bordercolor=cxFAFBFE borderwidth=2px fontweight=bold} ;
      line 'Species: ' species $20.;
    endcomp;
run;
ods layout end;
options byline;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1734574588569.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103196iAFB7EC862FE549EF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1734574588569.png" alt="Ksharp_0-1734574588569.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 02:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Using-BYVAL-in-titles-with-ODS-LAYOUT-GRIDDED-and-by-group/m-p/954122#M26796</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-12-19T02:16:43Z</dc:date>
    </item>
  </channel>
</rss>

