<?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: Complex aggregate calculation help in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Complex-aggregate-calculation-help/m-p/825193#M16251</link>
    <description>&lt;P&gt;Use table aggregator.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have to convert date into character variable by using the 'format' function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then construct the crossings you need.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AggregateTable(_Sum_, Table(_Sum_, Fixed('Repairing Region'n,&lt;BR /&gt;'_in-service-date'n, 'Engine Model'n), 'Frequency'n)) /&lt;BR /&gt;AggregateTable(_Sum_, Table(_Sum_, Fixed('Repairing Region'n,&lt;BR /&gt;'_in-service-date'n), 'Frequency'n))&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="want.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73691i9FFC1F54F09BDDD0/image-size/large?v=v2&amp;amp;px=999" role="button" title="want.png" alt="want.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jul 2022 08:48:14 GMT</pubDate>
    <dc:creator>acordes</dc:creator>
    <dc:date>2022-07-25T08:48:14Z</dc:date>
    <item>
      <title>Complex aggregate calculation help</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Complex-aggregate-calculation-help/m-p/824795#M16245</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm using Visual Analytics 8.5.&amp;nbsp; My data set consists of student credit hour group, race, gender, student headcount, semester etc.&amp;nbsp; I have three student credit hour groups (categorical variable): 16+, 15, 12-14.&amp;nbsp; Previously, I only was tasked to look at the 16+ credit hour group.&amp;nbsp; The question was to determine the percent of students taking 16+ credit hours by race/gender by semester, and this was displayed in a line graph.&amp;nbsp; To achieve this, in effect I created new variables for each race group, new variables for each gender group, and then new variables for each gender/race combination.&amp;nbsp; For example, if I wanted to know the % of Hispanic students, I used the following aggregate calculation:&lt;/P&gt;&lt;P&gt;Sum [_ByGroup_] ('TTLHispanic16+'n) / AggregateTable(_Sum_,&lt;BR /&gt;Table(_Sum_, Fixed('Semester'n), 'TTLHispanic'n))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created the variable TTLHispanic16+ using the following:&lt;/P&gt;&lt;P&gt;IF ( ( 'Credit Hour Group'n = '16+' ) AND ( 'race'n= 'Hispanic' ) )&lt;BR /&gt;RETURN 'Headcount'n&lt;BR /&gt;ELSE 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variable TTLHispanic was calculated similar to above.&amp;nbsp; This method was not ideal, but it worked as I only was looking at one of the three credit hour groups.&amp;nbsp; Now since I'm trying to use two more credit hour groups in my graph, it will look very messy to have multiple gender/race groups by credit hour group.&amp;nbsp; I would like to be able to get the % of each credit hour group by race (or gender, or race/gender) by semester, and this will be used in a line graph.&amp;nbsp; Ideally, each of these variables would be in a filter which the end user can select from.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, for Fall 2021, the percent of (16+ credit hours Hispanic/Total Hispanic) = (478/2701) = 17.7%.&amp;nbsp; I've attached sample data to illustrate where I got this value.&lt;/P&gt;&lt;P&gt;Can someone help with this calculation?&amp;nbsp; (% of each credit hour group by race, etc. by semester)&lt;/P&gt;&lt;P&gt;Thank you.&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="Screen Shot 2022-07-21 at 6.02.55 PM.png" style="width: 813px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73587i8C68B96BD4DCD08B/image-dimensions/813x158?v=v2" width="813" height="158" role="button" title="Screen Shot 2022-07-21 at 6.02.55 PM.png" alt="Screen Shot 2022-07-21 at 6.02.55 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 22:06:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Complex-aggregate-calculation-help/m-p/824795#M16245</guid>
      <dc:creator>silversky9</dc:creator>
      <dc:date>2022-07-21T22:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: Complex aggregate calculation help</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Complex-aggregate-calculation-help/m-p/825193#M16251</link>
      <description>&lt;P&gt;Use table aggregator.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have to convert date into character variable by using the 'format' function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then construct the crossings you need.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;AggregateTable(_Sum_, Table(_Sum_, Fixed('Repairing Region'n,&lt;BR /&gt;'_in-service-date'n, 'Engine Model'n), 'Frequency'n)) /&lt;BR /&gt;AggregateTable(_Sum_, Table(_Sum_, Fixed('Repairing Region'n,&lt;BR /&gt;'_in-service-date'n), 'Frequency'n))&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="want.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73691i9FFC1F54F09BDDD0/image-size/large?v=v2&amp;amp;px=999" role="button" title="want.png" alt="want.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 08:48:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Complex-aggregate-calculation-help/m-p/825193#M16251</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2022-07-25T08:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: Complex aggregate calculation help</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Complex-aggregate-calculation-help/m-p/825471#M16254</link>
      <description>Thanks so much, I was able to get what I needed. I appreciate the help!</description>
      <pubDate>Tue, 26 Jul 2022 17:10:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Complex-aggregate-calculation-help/m-p/825471#M16254</guid>
      <dc:creator>silversky9</dc:creator>
      <dc:date>2022-07-26T17:10:59Z</dc:date>
    </item>
  </channel>
</rss>

