<?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: Incorrect aggregation of ABS values in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Incorrect-aggregation-of-ABS-values/m-p/876301#M17217</link>
    <description>&lt;P&gt;Sounds like you have the order operations wrongs.&lt;/P&gt;
&lt;P&gt;You need to calculate ABS(actuals - forecast) first.&lt;/P&gt;
&lt;P&gt;Then generate the bottom line as the sums of those three variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks instead you generated the sums first and then did the same abs(actuals - forecast) for the summary line as you did for the detail lines.&lt;/P&gt;</description>
    <pubDate>Wed, 17 May 2023 18:38:43 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-05-17T18:38:43Z</dc:date>
    <item>
      <title>Incorrect aggregation of ABS values</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Incorrect-aggregation-of-ABS-values/m-p/876276#M17215</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to calculate a forecast accuracy in SAS VA 8.5.2 and the absolute error is not correctly aggregating/summing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a table similar to the one I am working with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="25%" height="30px"&gt;&lt;STRONG&gt;Brand&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;&lt;STRONG&gt;Actuals&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;&lt;STRONG&gt;Forecast&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;&lt;STRONG&gt;ABS Error (Abs(Actuals-Forecast)&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="30px"&gt;A&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;6,878&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;10,000&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;3,122&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="30px"&gt;B&lt;/TD&gt;
&lt;TD height="30px"&gt;165,473&lt;/TD&gt;
&lt;TD height="30px"&gt;333,648&lt;/TD&gt;
&lt;TD height="30px"&gt;168,175&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="30px"&gt;C&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;12,092&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;1,449&lt;/TD&gt;
&lt;TD width="25%" height="30px"&gt;10,643&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="30px"&gt;&lt;STRONG&gt;Total&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD height="30px"&gt;&lt;STRONG&gt;184,443&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD height="30px"&gt;&lt;STRONG&gt;345,097&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD height="30px"&gt;&lt;FONT color="#800000"&gt;&lt;STRONG&gt;160,654&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The ABS Error is correct, but the total is incorrect. It is not recognizing that these values are positive. The total should be &lt;FONT color="#339966"&gt;&lt;STRONG&gt;181,940.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Due to this incorrect aggregation, my forecast accuracy calculation is coming out to an unexpected and incorrect value and I'm wondering how I can correct this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 16:41:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Incorrect-aggregation-of-ABS-values/m-p/876276#M17215</guid>
      <dc:creator>illmatic</dc:creator>
      <dc:date>2023-05-17T16:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect aggregation of ABS values</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Incorrect-aggregation-of-ABS-values/m-p/876301#M17217</link>
      <description>&lt;P&gt;Sounds like you have the order operations wrongs.&lt;/P&gt;
&lt;P&gt;You need to calculate ABS(actuals - forecast) first.&lt;/P&gt;
&lt;P&gt;Then generate the bottom line as the sums of those three variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks instead you generated the sums first and then did the same abs(actuals - forecast) for the summary line as you did for the detail lines.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 18:38:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Incorrect-aggregation-of-ABS-values/m-p/876301#M17217</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-17T18:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect aggregation of ABS values</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Incorrect-aggregation-of-ABS-values/m-p/876312#M17219</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/434901"&gt;@illmatic&lt;/a&gt;! Based on the header of your list table, if your expression is this:&lt;/P&gt;
&lt;PRE&gt;abs('forecast'n - 'actuals'n)
&lt;/PRE&gt;
&lt;P&gt;Then you should be good.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on what you have, it looks like &lt;STRONG&gt;Total&lt;/STRONG&gt; is a part of your list table, which is why it's aggregating that way; however, this is the correct calculation for your overall forecast. Consider the following hypothetical forecast where the&amp;nbsp;&lt;STRONG&gt;Total&lt;/STRONG&gt; row is the sum of each column:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="376px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="71.25px"&gt;&lt;STRONG&gt;Product&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="77.5px"&gt;&lt;STRONG&gt;Forecast&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="80.5125px"&gt;&lt;STRONG&gt;Actual&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="57.8125px"&gt;&lt;STRONG&gt;Error&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="88.125px"&gt;&lt;STRONG&gt;Abs Error&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="71.25px"&gt;A&lt;/TD&gt;
&lt;TD width="77.5px"&gt;0&lt;/TD&gt;
&lt;TD width="80.5125px"&gt;100&lt;/TD&gt;
&lt;TD width="57.8125px"&gt;-100&lt;/TD&gt;
&lt;TD width="88.125px"&gt;100&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="71.25px"&gt;B&lt;/TD&gt;
&lt;TD width="77.5px"&gt;300&lt;/TD&gt;
&lt;TD width="80.5125px"&gt;200&lt;/TD&gt;
&lt;TD width="57.8125px"&gt;100&lt;/TD&gt;
&lt;TD width="88.125px"&gt;100&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="71.25px"&gt;C&lt;/TD&gt;
&lt;TD width="77.5px"&gt;300&lt;/TD&gt;
&lt;TD width="80.5125px"&gt;300&lt;/TD&gt;
&lt;TD width="57.8125px"&gt;0&lt;/TD&gt;
&lt;TD width="88.125px"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="71.25px"&gt;&lt;STRONG&gt;Total&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="77.5px"&gt;&lt;STRONG&gt;600&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="80.5125px"&gt;&lt;STRONG&gt;600&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="57.8125px"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="88.125px"&gt;&lt;STRONG&gt;200&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Total &lt;/STRONG&gt;is a bottom-up forecast created by summing up products A, B, and C. The individual forecasts of A and B are off by -100 and 100 respectively, but the overall bottom-up forecast has an error of 0: the errors in products A and B cancel each other out to create a perfect overall forecast. If you're trying to figure out how good your individual forecasts are, this can be a deceptive metric if your individual forecasts aren't great. The sum of the absolute errors tells us there are 200 total errors among all of the individual forecasts, but it does not mean that the overall forecast has an absolute error of 200.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to capture the total number of absolute errors of all forecasts, you need to remove the&amp;nbsp;&lt;STRONG&gt;Total&lt;/STRONG&gt; row and have Visual Analytics calculate the sum for you with the Totals option in a list table:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Stu_SAS_0-1684352213479.png" style="width: 318px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84066iAAE64F3F82B7CDB5/image-dimensions/318x178?v=v2" width="318" height="178" role="button" title="Stu_SAS_0-1684352213479.png" alt="Stu_SAS_0-1684352213479.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can filter out your&amp;nbsp;&lt;STRONG&gt;Total&lt;/STRONG&gt; row with an object filter so you do not need to reload the data:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Stu_SAS_1-1684352370794.png" style="width: 321px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84067i83417FD580EA77AB/image-dimensions/321x334?v=v2" width="321" height="334" role="button" title="Stu_SAS_1-1684352370794.png" alt="Stu_SAS_1-1684352370794.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, summing up all of the absolute errors is a relative measure and doesn't necessarily tell the whole story. One forecast could have a lot of errors while other forecasts could have a few. It's one indicator that there may be a problem with one or more forecasts, but it cannot be used to judge the accuracy of all hierarchical forecasts, especially if one hierarchy has large values while another hierarchy has low values. If you would like some good tips on how to judge the average accuracy of your hierarchical forecasts, I would recommend posting in the &lt;A href="https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/bd-p/forecasting_econometrics" target="_self"&gt;Forecasting and Econometrics forum&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generally I have always looked at MASE or MAPE values and sorted them in ascending order to view how well individual forecasts are doing.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 20:10:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Incorrect-aggregation-of-ABS-values/m-p/876312#M17219</guid>
      <dc:creator>Stu_SAS</dc:creator>
      <dc:date>2023-05-17T20:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect aggregation of ABS values</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Incorrect-aggregation-of-ABS-values/m-p/876326#M17221</link>
      <description>&lt;P&gt;Thanks Stu!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My actual formula in VA looks like so:&lt;/P&gt;
&lt;PRE&gt;Abs(Sum [_ByGroup_] (( 'Actuals'n - 'Forecast'n )))&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;does this change anything? Because&amp;nbsp;&lt;STRONG&gt;total&lt;/STRONG&gt; is not actually part of my table, but the output of VA when adding total for a list view. I only have it that way for the time being to troubleshoot why my forecast isn't coming out as expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I understand why this can be deceptive or maybe not best practice, but I am also layering other views where a traditional MAPE is shown (no abs errorin calc) and even a SMAPE value. We just deemed the absolute forecast as the best way to show this forecast for a particular hierarchy to satisfy a particular vendor's SLA requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 20:57:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Incorrect-aggregation-of-ABS-values/m-p/876326#M17221</guid>
      <dc:creator>illmatic</dc:creator>
      <dc:date>2023-05-17T20:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect aggregation of ABS values</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Incorrect-aggregation-of-ABS-values/m-p/876333#M17222</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm sorry, I'm not following.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So right now I have 400,000 (ignore previous values) when I total absolute error value. This is calculated by&lt;/P&gt;
&lt;P&gt;Abs(forecast - actuals)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But when summing up via list table total, I get a far lower number. Something around 180,000.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 22:04:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Incorrect-aggregation-of-ABS-values/m-p/876333#M17222</guid>
      <dc:creator>illmatic</dc:creator>
      <dc:date>2023-05-17T22:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect aggregation of ABS values</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Incorrect-aggregation-of-ABS-values/m-p/876337#M17223</link>
      <description>&lt;P&gt;You have to figure out how to get VA to behave like normal analysis.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input Brand $ Actuals Forecast;
cards;
A 6878 10000
B 165473 333648
C 12092 1449
;

data step1;
  set have;
  abs = abs(actuals - forecast);
run;

proc print;
 id brand;
 sum Actuals Forecast abs ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1684361403616.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84069i73453D3B0056F955/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1684361403616.png" alt="Tom_0-1684361403616.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You either loaded that extra TOTAL row with the real data.&amp;nbsp; Or you had it first calculate the totals and then asked it to take the difference of the totals.&amp;nbsp; Like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have;
  var actuals forecast ;
  output out=totals(drop=_:) sum=;
run;

data step1;
  set have totals;
  abs = abs(actuals-forecast);
run;

proc print;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_1-1684361592406.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84070iB01C91C362622C8B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_1-1684361592406.png" alt="Tom_1-1684361592406.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are doing the steps out of order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 22:13:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Incorrect-aggregation-of-ABS-values/m-p/876337#M17223</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-17T22:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect aggregation of ABS values</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Incorrect-aggregation-of-ABS-values/m-p/876351#M17224</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I figured it out.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When creating a new calculated value for the abs(error) make sure to change the result type from&amp;nbsp;&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-inline" image-alt="illmatic_1-1684368703699.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84072i34019819731009A3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="illmatic_1-1684368703699.png" alt="illmatic_1-1684368703699.png" /&gt;&lt;/span&gt;&amp;nbsp;to&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="illmatic_0-1684368642732.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84071i700D998A29EF28BA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="illmatic_0-1684368642732.png" alt="illmatic_0-1684368642732.png" /&gt;&lt;/span&gt;&amp;nbsp;on the top right&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Calculated fields switch to aggregated measure once you involve sum, but if you try to change it back, it errors out. So make sure to keep values as numeric so that each observation is calculated correctly (this will seem to be the case using either method, but where it falls apart is when you aggregate in visuals or total-up in a list table).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 00:13:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Incorrect-aggregation-of-ABS-values/m-p/876351#M17224</guid>
      <dc:creator>illmatic</dc:creator>
      <dc:date>2023-05-18T00:13:45Z</dc:date>
    </item>
  </channel>
</rss>

