<?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: minimum values of column by group in cas data in Developers</title>
    <link>https://communities.sas.com/t5/Developers/minimum-values-of-column-by-group-in-cas-data/m-p/483092#M102</link>
    <description>&lt;P&gt;thanks, it works!!!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you save my life&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for your help !!!!&lt;/P&gt;</description>
    <pubDate>Wed, 01 Aug 2018 15:37:37 GMT</pubDate>
    <dc:creator>improvingCas</dc:creator>
    <dc:date>2018-08-01T15:37:37Z</dc:date>
    <item>
      <title>minimum values of column by group in cas data</title>
      <link>https://communities.sas.com/t5/Developers/minimum-values-of-column-by-group-in-cas-data/m-p/482780#M100</link>
      <description>Hi !!&lt;BR /&gt;im new to sas viya&lt;BR /&gt;&lt;BR /&gt;i don't know how to find min value of column by group&lt;BR /&gt;&lt;BR /&gt;i have mycas.dist data like&lt;BR /&gt;&lt;BR /&gt;id var1 var2 var3 distance&lt;BR /&gt;1 1 1 1 0.2&lt;BR /&gt;1 2 1 2 0.3&lt;BR /&gt;2 1 1 3 0.9&lt;BR /&gt;2 1 2 1 0.2&lt;BR /&gt;3 1 3 2 0.1&lt;BR /&gt;&lt;BR /&gt;and i want to make table using mycas.dist like below table&lt;BR /&gt;&lt;BR /&gt;id var1 var2 var3 distance&lt;BR /&gt;1 1 1 1 0.2&lt;BR /&gt;2 1 2 1 0.2&lt;BR /&gt;3 1 3 2 0.1&lt;BR /&gt;&lt;BR /&gt;can i do it using cas data?</description>
      <pubDate>Tue, 31 Jul 2018 12:53:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/minimum-values-of-column-by-group-in-cas-data/m-p/482780#M100</guid>
      <dc:creator>improvingCas</dc:creator>
      <dc:date>2018-07-31T12:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: minimum values of column by group in cas data</title>
      <link>https://communities.sas.com/t5/Developers/minimum-values-of-column-by-group-in-cas-data/m-p/483068#M101</link>
      <description>&lt;P&gt;There is a DATA step solution. (Hmm...maybe there's a DATA step solution to everything.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since this requires BY-group processing, start by loading the data into partitions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;libname mycas cas;

data mycas.have(partition=(id) orderby=(distance) replace=yes);
  input id var1 var2 var3 distance;
  datalines;
1 1 1 1 0.2
1 2 1 2 0.3
2 1 1 3 0.9
2 1 2 1 0.2
3 1 3 2 0.1
;
run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then, use the SESSREF= DATA statement argument to insist that the DATA step runs in CAS:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mycas.want / sessref=casauto;
   set mycas.have;
   by id distance;
   if first.id then output;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Finally, check the work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc print data=mycas.want;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's lots of excellent DATA step in CAS documentation, such as the following:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=casdspgm&amp;amp;docsetTarget=n0jhhmgs0eiifen1djfd4go9mn8a.htm&amp;amp;locale=en" target="_self"&gt;BY-group processing in CAS&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(I made an update to this post because I left off the ORDERBY= data set option on the first DATA step.&amp;nbsp; With the option, the table is already organized according to the BY statement in the second DATA step--avoiding any reorganizing the data to sort it.&amp;nbsp; Without the data set option, the second DATA step has to make a temporary copy of the table--partitioning and sorting it.)&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2018 12:19:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/minimum-values-of-column-by-group-in-cas-data/m-p/483068#M101</guid>
      <dc:creator>MikeMcKiernan</dc:creator>
      <dc:date>2018-08-03T12:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: minimum values of column by group in cas data</title>
      <link>https://communities.sas.com/t5/Developers/minimum-values-of-column-by-group-in-cas-data/m-p/483092#M102</link>
      <description>&lt;P&gt;thanks, it works!!!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you save my life&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for your help !!!!&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2018 15:37:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/minimum-values-of-column-by-group-in-cas-data/m-p/483092#M102</guid>
      <dc:creator>improvingCas</dc:creator>
      <dc:date>2018-08-01T15:37:37Z</dc:date>
    </item>
  </channel>
</rss>

