<?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 Functions for maximum time values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Functions-for-maximum-time-values/m-p/233002#M42509</link>
    <description>&lt;P&gt;Hi, Are there any specific functions for finding the maximum for time variables as opposed to other numeric variables? I need to find the maximum time from an array of time variables.&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Wed, 04 Nov 2015 00:26:09 GMT</pubDate>
    <dc:creator>Maisha_Huq</dc:creator>
    <dc:date>2015-11-04T00:26:09Z</dc:date>
    <item>
      <title>Functions for maximum time values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Functions-for-maximum-time-values/m-p/233002#M42509</link>
      <description>&lt;P&gt;Hi, Are there any specific functions for finding the maximum for time variables as opposed to other numeric variables? I need to find the maximum time from an array of time variables.&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2015 00:26:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Functions-for-maximum-time-values/m-p/233002#M42509</guid>
      <dc:creator>Maisha_Huq</dc:creator>
      <dc:date>2015-11-04T00:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Functions for maximum time values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Functions-for-maximum-time-values/m-p/233005#M42511</link>
      <description>&lt;P&gt;I would try something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* if your variables are datetime variables, use the next two examples ... */
DATA have1;
  FORMAT dtm1 dtm2 dtm3 dtm4 DATETIME20.;
  dtm1 = '02NOV2015:19:31:12'dt;
  dtm2 = '02NOV2015:14:53:32'dt;
  dtm3 = '02NOV2015:06:06:11'dt;
  dtm4 = '02NOV2015:06:29:14'dt;
RUN;

DATA want1;
  SET have1;
  FORMAT max_of_dtm DATETIME20.;
  ARRAY dtm_array{*} dtm1-dtm4;
  max_of_dtm = MAX(of dtm_array{*});
RUN;

/* if your variables are time variables, use the next two examples ... */
DATA have2;
  FORMAT time_jim time_mary time_peter time_john TIME8.;
  time_jim   = '19:31:12't;
  time_mary  = '14:53:32't;
  time_peter = '06:06:11't;
  time_john  = '06:29:14't;
RUN;

DATA want2;
  SET have2;
  FORMAT max_of_time TIME8.;
  ARRAY time_array{*} time_jim time_mary time_peter time_john;
  max_of_time = MAX(of time_array{*});
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Nov 2015 01:01:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Functions-for-maximum-time-values/m-p/233005#M42511</guid>
      <dc:creator>hbi</dc:creator>
      <dc:date>2015-11-04T01:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Functions for maximum time values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Functions-for-maximum-time-values/m-p/233017#M42514</link>
      <description>&lt;P&gt;SAS dates and datetimes are just plain numbers counting days and seconds, respectively. So any numeric operator or function can be used with them. Sum, difference, min, max, and range work just as you would expect, as long as all operands are of the same type (all times or all dates). SAS will even let you do silly things like myDate**2 without complaining, that is, until you try to print the resulting value as a date.&lt;/P&gt;
&lt;P&gt;hth.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2015 03:34:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Functions-for-maximum-time-values/m-p/233017#M42514</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-11-04T03:34:45Z</dc:date>
    </item>
  </channel>
</rss>

