<?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: How to create a Total YTD row witout totaling percentage? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-Total-YTD-row-witout-totaling-percentage/m-p/843203#M333371</link>
    <description>Thank  you for your time and looking over my code. I used your suggestion and it worked perfectly. I appreciate it!!</description>
    <pubDate>Tue, 08 Nov 2022 17:59:04 GMT</pubDate>
    <dc:creator>LMSSAS</dc:creator>
    <dc:date>2022-11-08T17:59:04Z</dc:date>
    <item>
      <title>How to create a Total YTD row witout totaling percentage?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-Total-YTD-row-witout-totaling-percentage/m-p/842548#M333159</link>
      <description>&lt;P&gt;Can anyone offer a suggestion on how NOT to sum my percentages in last row?(Visual velow code) I need to divide the Total YTD "YOY Difference" by the Total YTD "AEP Sales 2022" rather than summing percentages. OR another option would be to make the&amp;nbsp;&lt;SPAN&gt;make the text in just that one cell the same color as the background to make it look like its not there. Is this possible to do with the compute?&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc sql; create table AEP_Compare as
select distinct *,
'2022'n-'2021'n as Difference format=comma10.,
('2022'n-'2021'n)/'2021'n as'% Change'n format=percent10.2
From Output
group by 'Submit Date'n,'2021'n, '2022'n
;quit;

proc report data=AEP_Compare nowd split='|' /* spanrows */
	style(header) = [font=("Arial",10.0pt) vjust=middle just=center background=%RGB(0,145,204) foreground=whitesmoke font_weight=bold]
	style(column) = [font=("Arial",8.58pt) bordercolor=%RGB(242,242,242) ];

	cols 'Submit Date'n '2022'n '2021'n Difference '% Change'n ;

	define 'Submit Date'n / Display "Application | Submit Date" order=data ;
	define '2022'n / Sum "AEP Sales | 2023" style(column)={vjust=c just=c cellwidth = 1in} order=data ;
	define '2021'n / Sum "AEP Sales | 2022" style(column)={vjust=c just=c cellwidth = 1in} order=data;
	define Difference / "YOY | Difference";
	define '% Change'n / "% Change" style(column)={vjust=c just=c cellwidth = 1in} /*format=percent10.2*/;

	rbreak after /summarize  style=[fontweight=bold];

	/* Compute block used to create table title */
compute before _page_/style=[font=("Arial",12.5pt) vjust=middle just=center background=whitesmoke foreground=%RGB(0,145,204) font_weight=bold borderbottomcolor=%RGB(242,242,242)];
		line "AEP Sales YoY Comparison"; /*%sysfunc(intnx(day,%sysfunc(today()),-7),worddate20.);*/
endcomp;

compute 'Submit Date'n;
	I + 1;
	if mod(i,2) eq 1 then
	call define(_row_, "style", "style=[background=%RGB(230,230,230)]");
endcomp;

compute after;
	'Submit Date'n = 'Total YTD';
	call define (_row_,'style','style=[backgroundcolor=lightgray foreground=black]');
endcomp;

compute '% change'n;
'% change'n=Difference/'2021'n ;
endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LMSSAS_0-1667585785958.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76945i379D163DDD1E4445/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LMSSAS_0-1667585785958.png" alt="LMSSAS_0-1667585785958.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 19:13:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-Total-YTD-row-witout-totaling-percentage/m-p/842548#M333159</guid>
      <dc:creator>LMSSAS</dc:creator>
      <dc:date>2022-11-04T19:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a Total YTD row witout totaling percentage?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-Total-YTD-row-witout-totaling-percentage/m-p/842566#M333168</link>
      <description>&lt;P&gt;I would use PROC SUMMARY (and perhaps a data step) to get the exact statistics you want on each row. Then once you have the exact SAS data set you want, then use that in PROC REPORT.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 20:22:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-Total-YTD-row-witout-totaling-percentage/m-p/842566#M333168</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-04T20:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a Total YTD row witout totaling percentage?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-Total-YTD-row-witout-totaling-percentage/m-p/842583#M333173</link>
      <description>&lt;P&gt;Does your AEP_COMPARE dataset already contain the &lt;EM&gt;'% Change'n&lt;/EM&gt; variable? If so, why would you calculate it again in a COMPUTE block, like you have?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;...
compute '% change'n;
'% change'n=Difference/'2021'n ;
endcomp;
...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you don't actually need to re-compute the&amp;nbsp;&lt;EM&gt;'% Change'n&amp;nbsp;&lt;/EM&gt;column, then the following may work for you.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Try running this example, which creates a report where the column of percentages is&amp;nbsp;&lt;EM&gt;not&amp;nbsp;&lt;/EM&gt;summed in the Total, by making use of the DISPLAY option. Is this along the same lines of what you are hoping to do?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table have as
    select name
          ,age
          ,height
          ,age/height as random_percentage format percent8.2
    from sashelp.class;
quit;

proc report data = have split='~'
    style(header)={font_weight=bold};
    column name age height random_percentage;

    define name / 'Name';
    define age / sum 'Age';
    define height / sum 'Height';
    define random_percentage / display 'Random Percentage' format=percent8.2;

    compute after;
    	name = 'Total:';
    	call define(_row_,'style','style={font_weight=bold}');
    endcomp;

    rbreak after / summarize dol dul;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mklangley_1-1667594143677.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76955i15262D24305A91A2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mklangley_1-1667594143677.png" alt="mklangley_1-1667594143677.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 21:19:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-Total-YTD-row-witout-totaling-percentage/m-p/842583#M333173</guid>
      <dc:creator>mklangley</dc:creator>
      <dc:date>2022-11-04T21:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a Total YTD row witout totaling percentage?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-Total-YTD-row-witout-totaling-percentage/m-p/843203#M333371</link>
      <description>Thank  you for your time and looking over my code. I used your suggestion and it worked perfectly. I appreciate it!!</description>
      <pubDate>Tue, 08 Nov 2022 17:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-Total-YTD-row-witout-totaling-percentage/m-p/843203#M333371</guid>
      <dc:creator>LMSSAS</dc:creator>
      <dc:date>2022-11-08T17:59:04Z</dc:date>
    </item>
  </channel>
</rss>

