<?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: Percentage total in List Table in SAS Visual Analytics wrong in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Percentage-total-in-List-Table-in-SAS-Visual-Analytics-wrong/m-p/890687#M17488</link>
    <description>That works. Thank you!</description>
    <pubDate>Thu, 24 Aug 2023 01:25:32 GMT</pubDate>
    <dc:creator>adilar39</dc:creator>
    <dc:date>2023-08-24T01:25:32Z</dc:date>
    <item>
      <title>Percentage total in List Table in SAS Visual Analytics wrong</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Percentage-total-in-List-Table-in-SAS-Visual-Analytics-wrong/m-p/888730#M17441</link>
      <description>&lt;P&gt;Hello everyone.&lt;/P&gt;
&lt;P&gt;I am using SAS code to get data from API, and I want to create a table that shown response rate. To create that table, I am using this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=work.TARGET_SKLM_KOTAKAB3;by KotaKabKecKel;run;
proc sort data=work.RESPONDEN_SKLM_KOTKAB2;by KotaKabKecKel;run;
	data work.Response_Rate;
		length KotaKabKecKel $200;
		merge work.RESPONDEN_SKLM_KOTKAB2(in=a) work.TARGET_SKLM_KOTAKAB3(in=b);
		by KotaKabKecKel;
		if b;
		format Capaian percent9.2;
		Capaian	= Responden/Data_valid;
		Kota_Kabupaten = KotaKabKecKel;
		drop KotaKabKecKel;
	run;

data Response_Rate2;
retain Kota_Kabupaten;
set Response_Rate;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;The result from that would look like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Result from code" style="width: 933px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86597i0C8B24B681EF9D69/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.jpg" alt="Result from code" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Result from code&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's the right result, and then I promote the table into caslib so I can visualize it in Visual Analytics.&lt;/P&gt;
&lt;P&gt;I then use List Table to show the result and it looks like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="List table" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86596iCAE68D7AC83DFE3D/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.jpg" alt="List table" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;List table&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because of default aggregation for measure data item is sum, the result looks like that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I want to ask, is there any way to rename "Sum:" in the total column?&lt;BR /&gt;And how to change the sum percentage to the right number ( 212/214 = 99.07% ) ?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 07:21:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Percentage-total-in-List-Table-in-SAS-Visual-Analytics-wrong/m-p/888730#M17441</guid>
      <dc:creator>adilar39</dc:creator>
      <dc:date>2023-08-10T07:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage total in List Table in SAS Visual Analytics wrong</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Percentage-total-in-List-Table-in-SAS-Visual-Analytics-wrong/m-p/888773#M17442</link>
      <description>&lt;P&gt;Calculate the value for capaian within the report using an expression like this:&lt;/P&gt;
&lt;PRE&gt;Sum(_ByGroup_, resp) / Sum(_ByGroup_,valid)&lt;/PRE&gt;
&lt;P&gt;Change the format to percent, use your names for the resp and valid. This will give you the correct total value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for the text in the total line, there is currently not a way to change this. I would simply not display the labels for the total values.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 09:46:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Percentage-total-in-List-Table-in-SAS-Visual-Analytics-wrong/m-p/888773#M17442</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2023-08-10T09:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage total in List Table in SAS Visual Analytics wrong</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Percentage-total-in-List-Table-in-SAS-Visual-Analytics-wrong/m-p/889275#M17450</link>
      <description>Thanks for the answer. I've used that way before.&lt;BR /&gt;&lt;BR /&gt;I thought that maybe I could get the same result like that in SAS Studio. Is there anyway to do that? Or it's not possible because when data promoted from SAS Studio, the data categorized as Measure Data with Sum as Aggregation?&lt;BR /&gt;Because when I compared between Capaian made from SAS Code and Capaian made with your way, the only difference is that the latter don't have Aggregation.&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Aug 2023 03:56:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Percentage-total-in-List-Table-in-SAS-Visual-Analytics-wrong/m-p/889275#M17450</guid>
      <dc:creator>adilar39</dc:creator>
      <dc:date>2023-08-15T03:56:28Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage total in List Table in SAS Visual Analytics wrong</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Percentage-total-in-List-Table-in-SAS-Visual-Analytics-wrong/m-p/889296#M17451</link>
      <description>&lt;P&gt;Yes you can achieve the same result using Proc REPORT, see code example below.&lt;/P&gt;
&lt;P&gt;Some explanation about the code:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;I always use a computed variable (_dummy) as the last one in the column statement. This will allow me to access all values to the left of this column in the compute block. It has the NOPRINT option, so it is not printed&lt;/LI&gt;
&lt;LI&gt;Since the resp and valid columns are defined as ANALYSIS using SUM I can use the &lt;STRONG&gt;variable-name.statistic&lt;/STRONG&gt; to access the value, this will also work for the report break line (RBREAK)&lt;/LI&gt;
&lt;LI&gt;In the compute block I can detect if I am in a break line and fill the variable kota accordingly&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Proc REPORT will build the report line by line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile cards dlm=",";
  input
    kota : $32.
    resp : 8.
    valid : 8.
  ;
cards;
seribu,18,18
barat,44,44
pusat,36,36
selatan,44,44
timur,35,35
utara,35,37
;

proc report data=have;
  column kota resp valid capian _dummy;
  define kota / group;
  define resp / analysis sum;
  define valid / analysis sum;
  define capian / computed format=percent9.2;
  define _dummy / computed noprint;
  
  rbreak after / summarize style={backgroundcolor=lightblue};
  compute _dummy ;
    capian = resp.sum / valid.sum;
    if _break_ = "_RBREAK_" then do;
      kota = "Total";
    end;
  endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Aug 2023 06:49:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Percentage-total-in-List-Table-in-SAS-Visual-Analytics-wrong/m-p/889296#M17451</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2023-08-15T06:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage total in List Table in SAS Visual Analytics wrong</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Percentage-total-in-List-Table-in-SAS-Visual-Analytics-wrong/m-p/890687#M17488</link>
      <description>That works. Thank you!</description>
      <pubDate>Thu, 24 Aug 2023 01:25:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Percentage-total-in-List-Table-in-SAS-Visual-Analytics-wrong/m-p/890687#M17488</guid>
      <dc:creator>adilar39</dc:creator>
      <dc:date>2023-08-24T01:25:32Z</dc:date>
    </item>
  </channel>
</rss>

