<?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: How to find a max value while restricting number of rows in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249677#M6666</link>
    <description>&lt;P&gt;Won't this take a really long time to go through 10 million rows?&lt;/P&gt;</description>
    <pubDate>Fri, 12 Feb 2016 14:36:44 GMT</pubDate>
    <dc:creator>jkurka</dc:creator>
    <dc:date>2016-02-12T14:36:44Z</dc:date>
    <item>
      <title>How to find a max value while restricting number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249584#M6657</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to develop a code that find the maximum value in a range of 1800 rows and subsequently condenses the data down to that one row, and then move on to the next 1800 and do the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Overall I have about 30 data sets, each of which has over 10 million rows, so am trying to use PROC SQL or PROC EXPAND as opposed to data step processing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone provide some help?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;- jkurka&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 03:49:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249584#M6657</guid>
      <dc:creator>jkurka</dc:creator>
      <dc:date>2016-02-12T03:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a max value while restricting number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249588#M6658</link>
      <description>&lt;P&gt;Is there some variable that identifies the 1800 rows?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 04:10:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249588#M6658</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-12T04:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a max value while restricting number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249591#M6659</link>
      <description>&lt;P&gt;Using PROC SQL and the monotonic () function I created a 'rows' variable, but that is all besides the variable (column) that has the data I want to aggregate.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 04:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249591#M6659</guid>
      <dc:creator>jkurka</dc:creator>
      <dc:date>2016-02-12T04:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a max value while restricting number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249593#M6660</link>
      <description>&lt;P&gt;I could provide an example for visualization. I'm sure that would help!&lt;/P&gt;&lt;P&gt;Say I'm starting with this and want to find the max within a range of each 3 variables:&lt;/P&gt;&lt;P&gt;rows&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp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&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like my output to show:&lt;/P&gt;&lt;P&gt;row&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4 &amp;nbsp;&amp;nbsp; --&amp;gt; max of first set of 3&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp; --&amp;gt; max of next set of 3&lt;/P&gt;&lt;P&gt;7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp; --&amp;gt; max of next set 3&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 04:39:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249593#M6660</guid>
      <dc:creator>jkurka</dc:creator>
      <dc:date>2016-02-12T04:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a max value while restricting number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249601#M6661</link>
      <description>&lt;P&gt;It's simple in a DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  keep row maximum;
  set have;
  retain maximum 0;
  maximum = max(maximum, var);
  if mod(_n_, 1800) = 0 then do;
    row = _n_;
    output; 
    maximum = 0;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note though that the data is read in the order it is stored. If the stored order changes then so do the maximums.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 06:57:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249601#M6661</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2016-02-12T06:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a max value while restricting number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249619#M6664</link>
      <description>&lt;P&gt;PROC SUMMARY has features that make this easy. &amp;nbsp;First you can use a view to add the group variable to your data, virtually speaking. &amp;nbsp;The IDGROUP OUTPUT statement option finds the MAX of age for each BY G(roup) created in the VIEW and the OUT sub-option defines the variable(s) to write to the data set that correspond to the MAX(AGE). &amp;nbsp;The OBS sub-option creates the _OBS_ variable with the observation number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let gsize=3;

data rowsv / view=rowsv;
   set sashelp.class;
   g + mod(_n_,&amp;amp;gsize) eq 1;
   run;
proc summary data=rowsv;
   by g;
   output out=max&amp;amp;gsize idgroup(max(age) obs out(name--weight)=);
   run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/1857i83C580357E7E1302/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 09:37:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249619#M6664</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-02-12T09:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a max value while restricting number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249677#M6666</link>
      <description>&lt;P&gt;Won't this take a really long time to go through 10 million rows?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 14:36:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249677#M6666</guid>
      <dc:creator>jkurka</dc:creator>
      <dc:date>2016-02-12T14:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a max value while restricting number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249684#M6667</link>
      <description>&lt;P&gt;The actual time it takes depends on many factors. It should take about the same for a procedure to read the data as data step. &amp;nbsp;Ideally&amp;nbsp;you want to make one pass of the data.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 14:45:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249684#M6667</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-02-12T14:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a max value while restricting number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249685#M6668</link>
      <description>&lt;P&gt;Thank you data_null__. Yes I'm keeping track of both posts. Wasn't aware of the duplicate until now. I'm giving your solution a try now!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 14:47:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249685#M6668</guid>
      <dc:creator>jkurka</dc:creator>
      <dc:date>2016-02-12T14:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a max value while restricting number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249688#M6669</link>
      <description>&lt;P&gt;It would be a good idea to show an example of your data. &amp;nbsp; If you have date-time and you want to group accordingly it might be better to use the date-time and a format or other rounding technique instead of observations number.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 14:54:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249688#M6669</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-02-12T14:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a max value while restricting number of rows</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249695#M6670</link>
      <description>&lt;P&gt;The data aren't timestamped. I've attached an excel example of a chuck of one file. As you can see it's simple, and just wanting the maximum value of every 1800 rows of the flt_z variable (last column).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the time that corresponds to the first row, but won't timestamp the full dataset due to it taking so long.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 15:08:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-find-a-max-value-while-restricting-number-of-rows/m-p/249695#M6670</guid>
      <dc:creator>jkurka</dc:creator>
      <dc:date>2016-02-12T15:08:52Z</dc:date>
    </item>
  </channel>
</rss>

