<?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: Proc SQL/SAS: How to select Lowest record number from output? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-SAS-How-to-select-Lowest-record-number-from-output/m-p/580135#M164769</link>
    <description>&lt;P&gt;If you're using proc sql Paige's is the best way to go, but I normally find with larger datasets a proc summary works a bit better, and is irrespective of other variables, if that's of use.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=your_data;
by descending subject time1;
var record;
output out=your_output_dataset min=;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;That should work!&lt;/P&gt;</description>
    <pubDate>Fri, 09 Aug 2019 14:23:10 GMT</pubDate>
    <dc:creator>millerm</dc:creator>
    <dc:date>2019-08-09T14:23:10Z</dc:date>
    <item>
      <title>Proc SQL/SAS: How to select Lowest record number from output?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-SAS-How-to-select-Lowest-record-number-from-output/m-p/580129#M164765</link>
      <description>&lt;P&gt;Given an input table, how to only select the lower RecordNumber of the same subject?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample Input Data:&lt;/P&gt;&lt;P&gt;╔═════════╦═══════╦═════════╗&lt;BR /&gt;║ Subject&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║ Time1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;║ Record&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║&lt;BR /&gt;╠═════════╬═══════╬═════════╣&lt;BR /&gt;║ 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║ 11:13&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║ 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║&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; ║ 11:13&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║ 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║&lt;/P&gt;&lt;P&gt;║ 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║ 11:17&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║ 5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║&lt;/P&gt;&lt;P&gt;║ 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║ 11:17&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║ 6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║&lt;BR /&gt;╚═════════╩═══════╩═════════╝&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output Data:&lt;/P&gt;&lt;P&gt;╔═════════╦═══════╦═════════╗&lt;BR /&gt;║ Subject&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║ Time1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;║ Record&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║&lt;BR /&gt;╠═════════╬═══════╬═════════╣&lt;BR /&gt;║ 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║ 11:13&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║ 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║&lt;BR /&gt;║ 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║ 11:17&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║ 5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ║&lt;BR /&gt;╚═════════╩═══════╩═════════╝&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Subject 1, Record 1 &amp;lt; Record 2. For Subject 2, Record 5 &amp;lt; Record 6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried doing something like this to first get the lowest RecordNumber and then trying to filter out the input data, but it still outputs essentially everything, unless I did something wrong here.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CREATE TABLE recordtemp AS
SELECT DISTINCT Subject, min(RecordPosition) as RecordPosition,
FROM output1
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;m open to either proc sql/SAS advices, but I am more experienced in SQL but I can't think of a way for this.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 14:11:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-SAS-How-to-select-Lowest-record-number-from-output/m-p/580129#M164765</guid>
      <dc:creator>jerrylshen</dc:creator>
      <dc:date>2019-08-09T14:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL/SAS: How to select Lowest record number from output?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-SAS-How-to-select-Lowest-record-number-from-output/m-p/580131#M164767</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/**** UNTESTED CODE *****/

proc sql;
    create table recordtemp as select * from output1
        group by subject having record=min(record);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Aug 2019 14:14:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-SAS-How-to-select-Lowest-record-number-from-output/m-p/580131#M164767</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-08-09T14:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL/SAS: How to select Lowest record number from output?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-SAS-How-to-select-Lowest-record-number-from-output/m-p/580134#M164768</link>
      <description>&lt;P&gt;Accepting this answer, but I actually found this post&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Proc-SQL-query-Select-Minimum-Record/td-p/296572" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Proc-SQL-query-Select-Minimum-Record/td-p/296572&lt;/A&gt;&amp;nbsp;like right before you replied lol but thanks for the quick reply!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 14:18:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-SAS-How-to-select-Lowest-record-number-from-output/m-p/580134#M164768</guid>
      <dc:creator>jerrylshen</dc:creator>
      <dc:date>2019-08-09T14:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL/SAS: How to select Lowest record number from output?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-SAS-How-to-select-Lowest-record-number-from-output/m-p/580135#M164769</link>
      <description>&lt;P&gt;If you're using proc sql Paige's is the best way to go, but I normally find with larger datasets a proc summary works a bit better, and is irrespective of other variables, if that's of use.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=your_data;
by descending subject time1;
var record;
output out=your_output_dataset min=;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;That should work!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 14:23:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-SAS-How-to-select-Lowest-record-number-from-output/m-p/580135#M164769</guid>
      <dc:creator>millerm</dc:creator>
      <dc:date>2019-08-09T14:23:10Z</dc:date>
    </item>
  </channel>
</rss>

