<?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 - Renaming the summary line for break and rbreak lines in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Renaming-the-summary-line-for-break-and-rbreak-lines/m-p/954850#M83833</link>
    <description>&lt;P&gt;Better post your dataset "work.syp1113 " to test your code, otherwise we just guess where is the problem.&lt;/P&gt;
&lt;P&gt;You could add one more COMPUTE block to rename it.&lt;/P&gt;
&lt;PRE&gt;options missing=0;
proc report data=work.syp1113 nowd;
where year=2024;
column region county month Total;
define region / group 'Region' width=15 format=$regionfmt. order=data;
define county / group 'County' width=20 format=$cntyfmt.;
define month / across 'Month'  width=20 format=monthfmt. order=internal;
define Total/computed;
  compute Total;
     Total=sum(_c2_, _c3_ ,_c4_, _c5_,_c6_,_c7_,_c8_,_c9_,_c10_,_c11_,_c12_,_c13_);
  endcomp;
break after Region /summarize style=[font_weight=bold];
rbreak after /summarize style=[font_weight=bold background=lightgrey];
compute after;
  region='State';
endcomp;
&lt;STRONG&gt;compute after Region; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;region='State'; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;endcomp;&lt;/STRONG&gt;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, for such CROSS table, I think the best choice is using PROC TABULATE.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jan 2025 02:40:12 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2025-01-01T02:40:12Z</dc:date>
    <item>
      <title>Proc Report - Renaming the summary line for break and rbreak lines</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Renaming-the-summary-line-for-break-and-rbreak-lines/m-p/954846#M83832</link>
      <description>&lt;P&gt;I am trying to rename the Break after Region to say Total instead of Region 11 repeated. I have tried using compute after but since I did that to rename the rbreak, it is not allowing me to use that twice. I have also tried to code within the same compute block, but it is not renaming the Region breaks to Total. Any suggestions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Proc Report Code&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;options missing=0;&lt;/P&gt;
&lt;P&gt;proc report data=work.syp1113 nowd;&lt;/P&gt;
&lt;P&gt;where year=2024;&lt;/P&gt;
&lt;P&gt;column region county month Total;&lt;/P&gt;
&lt;P&gt;define region / group 'Region' width=15 format=$regionfmt. order=data;&lt;/P&gt;
&lt;P&gt;define county / group 'County' width=20 format=$cntyfmt.;&lt;/P&gt;
&lt;P&gt;define month / across 'Month'&amp;nbsp; width=20 format=monthfmt. order=internal;&lt;/P&gt;
&lt;P&gt;define Total/computed;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; compute Total;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Total=sum(_c2_, _c3_ ,_c4_, _c5_,_c6_,_c7_,_c8_,_c9_,_c10_,_c11_,_c12_,_c13_);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; endcomp;&lt;/P&gt;
&lt;P&gt;break after Region /summarize style=[font_weight=bold];&lt;/P&gt;
&lt;P&gt;rbreak after /summarize style=[font_weight=bold background=lightgrey];&lt;/P&gt;
&lt;P&gt;compute after;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; region='State';&lt;/P&gt;
&lt;P&gt;endcomp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Current Output&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I would like the second Region 11 to be named Total instead of repeating the Region name.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mary_mcneill_0-1735693775289.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103415iA1D90A532E0C0C60/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mary_mcneill_0-1735693775289.png" alt="mary_mcneill_0-1735693775289.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jan 2025 01:09:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Renaming-the-summary-line-for-break-and-rbreak-lines/m-p/954846#M83832</guid>
      <dc:creator>mary_mcneill</dc:creator>
      <dc:date>2025-01-01T01:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report - Renaming the summary line for break and rbreak lines</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Renaming-the-summary-line-for-break-and-rbreak-lines/m-p/954850#M83833</link>
      <description>&lt;P&gt;Better post your dataset "work.syp1113 " to test your code, otherwise we just guess where is the problem.&lt;/P&gt;
&lt;P&gt;You could add one more COMPUTE block to rename it.&lt;/P&gt;
&lt;PRE&gt;options missing=0;
proc report data=work.syp1113 nowd;
where year=2024;
column region county month Total;
define region / group 'Region' width=15 format=$regionfmt. order=data;
define county / group 'County' width=20 format=$cntyfmt.;
define month / across 'Month'  width=20 format=monthfmt. order=internal;
define Total/computed;
  compute Total;
     Total=sum(_c2_, _c3_ ,_c4_, _c5_,_c6_,_c7_,_c8_,_c9_,_c10_,_c11_,_c12_,_c13_);
  endcomp;
break after Region /summarize style=[font_weight=bold];
rbreak after /summarize style=[font_weight=bold background=lightgrey];
compute after;
  region='State';
endcomp;
&lt;STRONG&gt;compute after Region; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;region='State'; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;endcomp;&lt;/STRONG&gt;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, for such CROSS table, I think the best choice is using PROC TABULATE.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jan 2025 02:40:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Renaming-the-summary-line-for-break-and-rbreak-lines/m-p/954850#M83833</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-01-01T02:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report - Renaming the summary line for break and rbreak lines</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Renaming-the-summary-line-for-break-and-rbreak-lines/m-p/955337#M83856</link>
      <description>&lt;P&gt;Thank you so much! I will also explore Proc Tabulate as al alternative as well &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 17:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Renaming-the-summary-line-for-break-and-rbreak-lines/m-p/955337#M83856</guid>
      <dc:creator>mary_mcneill</dc:creator>
      <dc:date>2025-01-07T17:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report - Renaming the summary line for break and rbreak lines</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Renaming-the-summary-line-for-break-and-rbreak-lines/m-p/955942#M83860</link>
      <description>&lt;P&gt;I updated this using proc tabulate, and I agree the cross table works better for this!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did have a quick question though. I have some counties within a Region that do not have any data but I still want that county label to be displayed within the Region variable with zeros for all months. When I add printmiss as an option to the table it will display all counties for the state for each Region, not just the counties within the Region itself. Do you know how I can code to only display the counties within the region to display if there is no data for that county?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options missing=0;&lt;BR /&gt;proc tabulate data=work.data format=5.;&lt;BR /&gt;format region $regionfmt. county $cntyfmt. month monthfmt. ;&lt;BR /&gt;class region county month year / preloadfmt;&lt;BR /&gt;where year = 2021;&lt;BR /&gt;table Region*(county all) all,month all;&lt;BR /&gt;keylabel n=' ' all='Total';&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is my output currently with the above code. Region 1 has 8 counties, but County 1 is missing because there is no data for that year. I am trying to still have the county name display with all 0s for each month.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mary_mcneill_0-1736788697486.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103688i27E8127A38F5523B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mary_mcneill_0-1736788697486.png" alt="mary_mcneill_0-1736788697486.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In my SAS code, Region is coded the following way:&lt;/P&gt;
&lt;P&gt;format region $10.;&lt;BR /&gt;if county in ('County 1','County 2','County 3','County 4','County 5','County 6','County 7','County 8')&lt;BR /&gt;then region = 'Region 1';&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2025 17:26:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Renaming-the-summary-line-for-break-and-rbreak-lines/m-p/955942#M83860</guid>
      <dc:creator>mary_mcneill</dc:creator>
      <dc:date>2025-01-13T17:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report - Renaming the summary line for break and rbreak lines</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Renaming-the-summary-line-for-break-and-rbreak-lines/m-p/955981#M83862</link>
      <description>&lt;P&gt;That would be better if you could post some data,so I could test your code.&lt;/P&gt;
&lt;P&gt;For your this special case,you could use option CLASSDATA= :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
do region='A','B','C';
 do county='X','Y','Z';
  do month=1 to 12;
    if region = 'C' and county = 'Z' then leave;
    output;
  end;
 end;
end;
run;

data classlevel;
 do region='A','B','C';
 do county='X','Y','Z';
 do month=1 to 12;
   output;
 end;
 end;
 end;
run;

options missing=0;
proc tabulate data=work.have format=5. classdata=classlevel;
class region county month ;
table Region*(county all) all,month='' all;
keylabel n=' ' all='Total';
run;&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-1736816618936.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103693iF9BE88976620BC30/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1736816618936.png" alt="Ksharp_0-1736816618936.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 01:04:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Renaming-the-summary-line-for-break-and-rbreak-lines/m-p/955981#M83862</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-01-14T01:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report - Renaming the summary line for break and rbreak lines</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Renaming-the-summary-line-for-break-and-rbreak-lines/m-p/956183#M83869</link>
      <description>&lt;P&gt;Here is a sample of the Data. Below is a list on the counties that make up each Region. There is no data for Region 1/County Black and Region 2/County White. When I use printmiss, it will display all counties for each Region, even if that county is not associated with that Region (i.e., it displays Counties Blue, Purple, Red, White for Region 1.&lt;/P&gt;
&lt;P&gt;Region 1 - Green, Yellow, Orange, Black&lt;/P&gt;
&lt;P&gt;Region 2 - Blue, Purple, Red, White&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want the table to display only the counites within each Region, even if there is not any data for that county for a particular year, but not all counties for all Regions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="255"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="48"&gt;month&lt;/TD&gt;
&lt;TD width="35"&gt;year&lt;/TD&gt;
&lt;TD width="98"&gt;county&lt;/TD&gt;
&lt;TD width="74"&gt;region&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;2024&lt;/TD&gt;
&lt;TD&gt;GREEN&lt;/TD&gt;
&lt;TD&gt;Region 1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;2024&lt;/TD&gt;
&lt;TD&gt;GREEN&lt;/TD&gt;
&lt;TD&gt;Region 1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;2024&lt;/TD&gt;
&lt;TD&gt;YELLOW&lt;/TD&gt;
&lt;TD&gt;Region 1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;2024&lt;/TD&gt;
&lt;TD&gt;YELLOW&lt;/TD&gt;
&lt;TD&gt;Region 1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;2024&lt;/TD&gt;
&lt;TD&gt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t;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;2024&lt;/TD&gt;
&lt;TD&gt;RED&lt;/TD&gt;
&lt;TD&gt;Region 3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;2024&lt;/TD&gt;
&lt;TD&gt;RED&lt;/TD&gt;
&lt;TD&gt;Region 3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;2024&lt;/TD&gt;
&lt;TD&gt;RED&lt;/TD&gt;
&lt;TD&gt;Region 3&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Wed, 15 Jan 2025 13:09:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Renaming-the-summary-line-for-break-and-rbreak-lines/m-p/956183#M83869</guid>
      <dc:creator>mary_mcneill</dc:creator>
      <dc:date>2025-01-15T13:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report - Renaming the summary line for break and rbreak lines</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Renaming-the-summary-line-for-break-and-rbreak-lines/m-p/956268#M83870</link>
      <description>&lt;P&gt;Still hard to understand your question.&lt;/P&gt;
&lt;P&gt;Can you post your desired output ?&lt;/P&gt;
&lt;P&gt;Is the following what you are looking for ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data data;
infile cards expandtabs truncover;
input month	year	county $	region &amp;amp;$20.;
cards;
1	2024	GREEN	Region 1
1	2024	GREEN	Region 1
1	2024	YELLOW	Region 1
2	2024	YELLOW	Region 1
3	2024	YELLOW	Region 1
1	2024	ORANGE	Region 1
1	2024	ORANGE	Region 1
10	2024	BLUE	Region 2
11	2024	BLUE	Region 2
11	2024	BLUE	Region 2
1	2024	PURPLE	Region 2
3	2024	PURPLE	Region 2
2	2024	RED	Region 3
2	2024	RED	Region 3
2	2024	RED	Region 3
2	2024	RED	Region 3
;
proc sql;
create table levels as
select distinct county,region
 from data
union
select 'Black' ,'Region 1'from data(obs=1)
union
select 'Red','Region 2' from data(obs=1)
union
select 'White','Region 2' from data(obs=1)
;

create table classdata as
select * from (select distinct month from data),
                (select distinct year from data),
                (select * from levels)
;
quit;





options missing=0;
proc tabulate data=work.data classdata=classdata format=5.;
class region county month year ;
table Region*(county all) all,month all;
keylabel n=' ' all='Total';
run;&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-1736991742346.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103738i6E974D30E4B32E83/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1736991742346.png" alt="Ksharp_0-1736991742346.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 01:42:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Renaming-the-summary-line-for-break-and-rbreak-lines/m-p/956268#M83870</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-01-16T01:42:28Z</dc:date>
    </item>
  </channel>
</rss>

