<?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: max date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/max-date/m-p/457658#M116049</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127990"&gt;@teja5959&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi i have only character format dates this dates how to calculate maximum dates length also different one data set date length has $10 another data set length has $12 in this two data sets i want only max dates .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ex;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data exp;&lt;BR /&gt;length dt $10;&lt;BR /&gt;input id dt $;&lt;BR /&gt;datalines;&lt;BR /&gt;101 2017/01/22&lt;BR /&gt;101 2018/01/20&lt;BR /&gt;102 2015/02/20&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data exp1;&lt;BR /&gt;length dt $12;&lt;BR /&gt;input id dt $;&lt;BR /&gt;datalines;&lt;BR /&gt;101 2017/01/25&lt;BR /&gt;101 2018/01/30&lt;BR /&gt;102 2015/02/19&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please try to rephrase your question in understandable English. Use periods to separate your sentences.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Apr 2018 10:02:53 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-04-26T10:02:53Z</dc:date>
    <item>
      <title>max date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/max-date/m-p/457654#M116048</link>
      <description>&lt;P&gt;Hi i have only character format dates this dates how to calculate maximum dates length also different one data set date length has $10 another data set length has $12 in this two data sets i want only max dates .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ex;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data exp;&lt;BR /&gt;length dt $10;&lt;BR /&gt;input id dt $;&lt;BR /&gt;datalines;&lt;BR /&gt;101 2017/01/22&lt;BR /&gt;101 2018/01/20&lt;BR /&gt;102 2015/02/20&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data exp1;&lt;BR /&gt;length dt $12;&lt;BR /&gt;input id dt $;&lt;BR /&gt;datalines;&lt;BR /&gt;101 2017/01/25&lt;BR /&gt;101 2018/01/30&lt;BR /&gt;102 2015/02/19&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 09:57:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/max-date/m-p/457654#M116048</guid>
      <dc:creator>teja5959</dc:creator>
      <dc:date>2018-04-26T09:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: max date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/max-date/m-p/457658#M116049</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127990"&gt;@teja5959&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi i have only character format dates this dates how to calculate maximum dates length also different one data set date length has $10 another data set length has $12 in this two data sets i want only max dates .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ex;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data exp;&lt;BR /&gt;length dt $10;&lt;BR /&gt;input id dt $;&lt;BR /&gt;datalines;&lt;BR /&gt;101 2017/01/22&lt;BR /&gt;101 2018/01/20&lt;BR /&gt;102 2015/02/20&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data exp1;&lt;BR /&gt;length dt $12;&lt;BR /&gt;input id dt $;&lt;BR /&gt;datalines;&lt;BR /&gt;101 2017/01/25&lt;BR /&gt;101 2018/01/30&lt;BR /&gt;102 2015/02/19&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please try to rephrase your question in understandable English. Use periods to separate your sentences.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 10:02:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/max-date/m-p/457658#M116049</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-26T10:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: max date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/max-date/m-p/457661#M116051</link>
      <description>&lt;P&gt;Convert to numeric dates.&amp;nbsp; Get max.&amp;nbsp; Its will be a lot of effort for no gain to keep them as text.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 10:08:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/max-date/m-p/457661#M116051</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-26T10:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: max date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/max-date/m-p/457663#M116053</link>
      <description>&lt;P&gt;It's easy enough to run PROC CONTENTS on each data set.&amp;nbsp; Then you can change the length to the longer length by hard-coding a length:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data exp;&lt;/P&gt;
&lt;P&gt;length dt $ 12;&lt;/P&gt;
&lt;P&gt;set exp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The LENGTH statement must come before the SET statement.&amp;nbsp; However, you also have to realize that this may not be a good solution.&amp;nbsp; What if the maximum length turned out to be $200?&amp;nbsp; There's probably a lot of extra space being used unnecessarily.&amp;nbsp; You should at least consider a solution that explores how many characters are needed.&amp;nbsp; For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test_exp;&lt;/P&gt;
&lt;P&gt;set exp;&lt;/P&gt;
&lt;P&gt;len_dt = lengthn(dt);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;proc means data=test_exp max maxdec=0;&lt;/P&gt;
&lt;P&gt;var len_dt;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That program tells you how many characters are actually needed.&amp;nbsp; You would need to run a similar program for each of your data sets, to discover how many characters are needed across all data sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;... it is worth learning how SAS handles dates, and converting your dates to numeric values.&amp;nbsp; The solution I provided is more general, and can be applied to non-date variables.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Apr 2018 10:16:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/max-date/m-p/457663#M116053</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-26T10:16:29Z</dc:date>
    </item>
  </channel>
</rss>

