<?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: Finding the lowest date in a column in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559481#M10336</link>
    <description>&lt;P&gt;You can use PROC MEANS or PROC SUMMARY and have it compute the MIN of the column of interest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The MIN function (which you tried) finds the minimum across a row.&lt;/P&gt;</description>
    <pubDate>Thu, 16 May 2019 20:11:34 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2019-05-16T20:11:34Z</dc:date>
    <item>
      <title>Finding the lowest date in a column</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559479#M10335</link>
      <description>&lt;P&gt;Hi, I need to find the lowest value in a date column, but i'm not entirely sure how to go about it.&lt;/P&gt;&lt;P&gt;Sample data attached.&lt;/P&gt;&lt;P&gt;I'm new to this, but I tried using a min function, that didn't work.&lt;/P&gt;&lt;P&gt;Tried creating a case to cover it, but that didn't either, any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 20:09:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559479#M10335</guid>
      <dc:creator>Schmageggy</dc:creator>
      <dc:date>2019-05-16T20:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the lowest date in a column</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559481#M10336</link>
      <description>&lt;P&gt;You can use PROC MEANS or PROC SUMMARY and have it compute the MIN of the column of interest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The MIN function (which you tried) finds the minimum across a row.&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 20:11:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559481#M10336</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-16T20:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the lowest date in a column</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559482#M10337</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select min(date) from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Replace dataset and column name as needed.&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 20:20:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559482#M10337</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-05-16T20:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the lowest date in a column</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559488#M10341</link>
      <description>What do you want to do with the minimum after you find it?&lt;BR /&gt;&lt;BR /&gt;The approaches here may help, just replace mean with min. &lt;BR /&gt;&lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/add_average_value_to_dataset.sas" target="_blank"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/add_average_value_to_dataset.sas&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/proc_means_basic.sas" target="_blank"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/proc_means_basic.sas&lt;/A&gt;</description>
      <pubDate>Thu, 16 May 2019 20:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559488#M10341</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-16T20:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the lowest date in a column</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559509#M10348</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/272798"&gt;@Schmageggy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi, I need to find the lowest value in a date column, but i'm not entirely sure how to go about it.&lt;/P&gt;
&lt;P&gt;Sample data attached.&lt;/P&gt;
&lt;P&gt;I'm new to this, but I tried using a min function, that didn't work.&lt;/P&gt;
&lt;P&gt;Tried creating a case to cover it, but that didn't either, any help is appreciated.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Didn't work is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form &lt;STRONG&gt;of data step code&lt;/STRONG&gt; pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&lt;/A&gt;... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;XLSX &lt;STRONG&gt;are not&lt;/STRONG&gt; SAS data sets. Any choice I make to turn such into a SAS data set may result in differences if variable type, values (especially with dates, times or datetime values), and variable lengths from your SAS data.&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 22:53:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559509#M10348</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-16T22:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the lowest date in a column</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559516#M10349</link>
      <description>&lt;P&gt;I'm trying to make a computed column with the lowest date so then I can run a select distinct query excluding the original column and result in one date per record. &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 250px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29585i5B70676923EE968F/image-dimensions/250x169?v=v2" width="250" height="169" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2019 23:15:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559516#M10349</guid>
      <dc:creator>Schmageggy</dc:creator>
      <dc:date>2019-05-16T23:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the lowest date in a column</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559581#M10361</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/272798"&gt;@Schmageggy&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to select the row with the lowest datetime value within a group then code as below should do the job.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  do record='Record1', 'Record2';
    do othervar=0 to 100000 by 10000;
      dttm=datetime()-othervar;
      output;
    end;
  end;
  stop;
  format dttm datetime20.;
run;

proc sql;
/*  create table want as*/
  select
    record,
    othervar,
    min(dttm) as min_dttm format=datetime20.
  from have
  group by record
  having min(dttm)=dttm
  ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The SQL above is something you can "click together" using the EG Query Builder.&lt;/P&gt;
&lt;P&gt;Once you create the calculated column "min_dttm" you will get additional options to chose from.&lt;/P&gt;
&lt;P&gt;The GROUP BY in above SQL gets created based on what you define in pane "Summary Groups"&lt;/P&gt;
&lt;P&gt;The HAVING clause gets created based on what you define under tab "Filter Data"/"Filter the summarized data"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Correction:&lt;/P&gt;
&lt;P&gt;The having clause was:&amp;nbsp;&amp;nbsp;&lt;CODE class=" language-sas"&gt;having &lt;FONT color="#FF0000"&gt;max&lt;/FONT&gt;(dttm)=dttm&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;The test must use min() of course:&amp;nbsp;&lt;CODE class=" language-sas"&gt;having &lt;FONT color="#FF0000"&gt;min&lt;/FONT&gt;(dttm)=dttm&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;Fixed now.&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 23:45:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559581#M10361</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-05-17T23:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the lowest date in a column</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559692#M10378</link>
      <description>That did it, thank you. But yeah I am using EG as SQL while not completely foreign, I have not learned or been trained in my current role. Should probably work on that. Thank you again.</description>
      <pubDate>Fri, 17 May 2019 15:23:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559692#M10378</guid>
      <dc:creator>Schmageggy</dc:creator>
      <dc:date>2019-05-17T15:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the lowest date in a column</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559783#M10386</link>
      <description>SAS has two free e courses available to get you started.</description>
      <pubDate>Fri, 17 May 2019 20:10:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Finding-the-lowest-date-in-a-column/m-p/559783#M10386</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-17T20:10:45Z</dc:date>
    </item>
  </channel>
</rss>

