<?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 How to derive variables across rows based on a Key column in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-derive-variables-across-rows-based-on-a-Key-column/m-p/269103#M4126</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a LASR table which contains columns as below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;TranDate&lt;/TD&gt;&lt;TD&gt;Flg_1&lt;/TD&gt;&lt;TD&gt;Val_1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;31-Dec-15&lt;/TD&gt;&lt;TD&gt;AA&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;31-Jan-15&lt;/TD&gt;&lt;TD&gt;BB&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;31-Dec-15&lt;/TD&gt;&lt;TD&gt;DD&lt;/TD&gt;&lt;TD&gt;111&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;31-Jan-15&lt;/TD&gt;&lt;TD&gt;AA&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2345&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So i want to create calculated variables based on the comparision of&amp;nbsp;values of Flg_1&amp;nbsp;for the 2 TranDate selected by the users&amp;nbsp;for a particular ID (Something similar i can do with a merge using By variable as ID)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently i am doing it in SAS and loading the results back to LASR server, but i wish to have this dynamic based on the TranDate's that the user of the report select.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if there is any way to achive this requirement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS VA Version : 7.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Abhi&lt;/P&gt;</description>
    <pubDate>Mon, 09 May 2016 04:40:01 GMT</pubDate>
    <dc:creator>AbhiD</dc:creator>
    <dc:date>2016-05-09T04:40:01Z</dc:date>
    <item>
      <title>How to derive variables across rows based on a Key column</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-derive-variables-across-rows-based-on-a-Key-column/m-p/269103#M4126</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a LASR table which contains columns as below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;TranDate&lt;/TD&gt;&lt;TD&gt;Flg_1&lt;/TD&gt;&lt;TD&gt;Val_1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;31-Dec-15&lt;/TD&gt;&lt;TD&gt;AA&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;31-Jan-15&lt;/TD&gt;&lt;TD&gt;BB&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;31-Dec-15&lt;/TD&gt;&lt;TD&gt;DD&lt;/TD&gt;&lt;TD&gt;111&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;31-Jan-15&lt;/TD&gt;&lt;TD&gt;AA&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2345&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So i want to create calculated variables based on the comparision of&amp;nbsp;values of Flg_1&amp;nbsp;for the 2 TranDate selected by the users&amp;nbsp;for a particular ID (Something similar i can do with a merge using By variable as ID)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently i am doing it in SAS and loading the results back to LASR server, but i wish to have this dynamic based on the TranDate's that the user of the report select.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if there is any way to achive this requirement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS VA Version : 7.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Abhi&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2016 04:40:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-derive-variables-across-rows-based-on-a-Key-column/m-p/269103#M4126</guid>
      <dc:creator>AbhiD</dc:creator>
      <dc:date>2016-05-09T04:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to derive variables across rows based on a Key column</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-derive-variables-across-rows-based-on-a-Key-column/m-p/271798#M4280</link>
      <description>&lt;P&gt;Abhi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Formulas within a row (on a row by row basis) is accomplished within the VA Software ala 'Calculated Items'.&lt;/P&gt;
&lt;P&gt;Formulas across rows (on a group by basis) is accomplished within the VA Software ala 'Aggregated Measures'.&lt;/P&gt;
&lt;P&gt;An example output of 'Aggregated Measures' sort of based on your sample data is attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With that said, the "comparison of values" (as your worded it) possibilities is going to depend on what Aggregation functions the software provides (e.g. Min, Max, etc.)&amp;nbsp;vs. the actual "comparison" you are hoping to accomplish.&amp;nbsp; Documentation on Aggregations possible within VA can be found here (note ... this is from v7.3 but should still apply to your v7.1):&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/vaug/68648/HTML/default/viewer.htm#n14e1aiiioais5n1ruouchky8rwo.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/vaug/68648/HTML/default/viewer.htm#n14e1aiiioais5n1ruouchky8rwo.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;(and above applies to Visual Analytics Explorer as well as Designer/Reporter).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, if you need to perform some complicated IF-THEN-ELSE statement as your "comparison of values", you may have to alternatively transpose the data (prior to VA Reporting) so there's multiple columns (to compare) for each record of the data.&amp;nbsp; Then you would utilize 'Calculated Items' (and not 'Aggregated Measures').&amp;nbsp; For example ...&lt;/P&gt;
&lt;P&gt;IF ( 'Variable A'n &amp;gt; 'Variable B'n )&lt;BR /&gt;RETURN ( &lt;BR /&gt;&amp;nbsp; IF ( 'Variable A'n &amp;gt; 'Variable C'n )&lt;BR /&gt;&amp;nbsp; RETURN 'Variable A'n&lt;BR /&gt;&amp;nbsp; ELSE 'Variable C'n )&lt;BR /&gt;ELSE ( &lt;BR /&gt;&amp;nbsp; IF ( 'Variable B'n &amp;gt; 'Variable C'n )&lt;BR /&gt;&amp;nbsp; RETURN 'Variable B'n&lt;BR /&gt;&amp;nbsp; ELSE 'Variable C'n )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Ted Stolarczyk, SAS Customer Loyalty team&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12559iFD080D5AB6C61260/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="SAS_VA_Aggregation_Example.jpg" title="SAS_VA_Aggregation_Example.jpg" /&gt;</description>
      <pubDate>Thu, 19 May 2016 18:04:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/How-to-derive-variables-across-rows-based-on-a-Key-column/m-p/271798#M4280</guid>
      <dc:creator>TedStolarczyk</dc:creator>
      <dc:date>2016-05-19T18:04:48Z</dc:date>
    </item>
  </channel>
</rss>

