<?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 dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/dates/m-p/646238#M193277</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to find maximum value from all dates variable which is present in Macro variable"&amp;nbsp; &amp;amp;dates. ". Can someone help me how to find Maximum value from this all dates. I convert all dates in date9. format by using following code.&amp;nbsp; I wrote following code to find maximum value but it gives me error message.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be appreciated .&lt;/P&gt;&lt;P&gt;Thank you in Advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;****************************&amp;nbsp; DATA SET STATEMENT ***********************&lt;/P&gt;&lt;P&gt;data now;&lt;BR /&gt;set nn;&lt;BR /&gt;format &amp;amp;dates date9.;&lt;BR /&gt;informat &amp;amp;dates date9.;&lt;BR /&gt;where Subject^='';&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=now out=new_; by subject; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data ll;&lt;BR /&gt;set now_;&lt;BR /&gt;date1=max(&amp;amp;dates);&lt;BR /&gt;format date1 date9.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*******************&amp;nbsp; LOG ERROR MESSAGE *********************************&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: File WORK.NOW_.DATA does not exist.&lt;BR /&gt;35 date1=max(&amp;amp;dates);&lt;BR /&gt;NOTE: Line generated by the macro variable "DATES".&lt;BR /&gt;35 EGDT EGDT_AT6 EXEGDT LSTSMKDT ACCUDT ASESDT CNTRDT EDSSDT EVALDT EXAMDT HPTEVLDT PFDT PFMKDT PFTDT SDMTASDT DSDT PGNDT&lt;BR /&gt;________&lt;BR /&gt;388&lt;BR /&gt;76&lt;BR /&gt;35 ! LBDT PEDT PEASSDT ESSDT HADSDT PWCDT SUICDT QUEDT VSDT VSNDT MRIDT AESTDT AEENDT VISDT CMSTDT1 CMENDT1 ENSYMDT MSRLDT&lt;BR /&gt;35 ! RELAPDT STSYMDT&lt;BR /&gt;ERROR 388-185: Expecting an arithmetic operator.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;</description>
    <pubDate>Fri, 08 May 2020 15:05:56 GMT</pubDate>
    <dc:creator>unnati</dc:creator>
    <dc:date>2020-05-08T15:05:56Z</dc:date>
    <item>
      <title>dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dates/m-p/646238#M193277</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to find maximum value from all dates variable which is present in Macro variable"&amp;nbsp; &amp;amp;dates. ". Can someone help me how to find Maximum value from this all dates. I convert all dates in date9. format by using following code.&amp;nbsp; I wrote following code to find maximum value but it gives me error message.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be appreciated .&lt;/P&gt;&lt;P&gt;Thank you in Advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;****************************&amp;nbsp; DATA SET STATEMENT ***********************&lt;/P&gt;&lt;P&gt;data now;&lt;BR /&gt;set nn;&lt;BR /&gt;format &amp;amp;dates date9.;&lt;BR /&gt;informat &amp;amp;dates date9.;&lt;BR /&gt;where Subject^='';&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=now out=new_; by subject; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data ll;&lt;BR /&gt;set now_;&lt;BR /&gt;date1=max(&amp;amp;dates);&lt;BR /&gt;format date1 date9.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*******************&amp;nbsp; LOG ERROR MESSAGE *********************************&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: File WORK.NOW_.DATA does not exist.&lt;BR /&gt;35 date1=max(&amp;amp;dates);&lt;BR /&gt;NOTE: Line generated by the macro variable "DATES".&lt;BR /&gt;35 EGDT EGDT_AT6 EXEGDT LSTSMKDT ACCUDT ASESDT CNTRDT EDSSDT EVALDT EXAMDT HPTEVLDT PFDT PFMKDT PFTDT SDMTASDT DSDT PGNDT&lt;BR /&gt;________&lt;BR /&gt;388&lt;BR /&gt;76&lt;BR /&gt;35 ! LBDT PEDT PEASSDT ESSDT HADSDT PWCDT SUICDT QUEDT VSDT VSNDT MRIDT AESTDT AEENDT VISDT CMSTDT1 CMENDT1 ENSYMDT MSRLDT&lt;BR /&gt;35 ! RELAPDT STSYMDT&lt;BR /&gt;ERROR 388-185: Expecting an arithmetic operator.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2020 15:05:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dates/m-p/646238#M193277</guid>
      <dc:creator>unnati</dc:creator>
      <dc:date>2020-05-08T15:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dates/m-p/646243#M193279</link>
      <description>&lt;P&gt;First thing is fix errors:&lt;/P&gt;
&lt;PRE&gt;proc sort data=now out=&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;new_&lt;/FONT&gt;&lt;/STRONG&gt;; by subject; run;

data ll;
set &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;now_&lt;/STRONG&gt;&lt;/FONT&gt;;
date1=max(&amp;amp;dates);
format date1 date9.;
run;&lt;/PRE&gt;
&lt;P&gt;The second data step did not reference the sorted data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second the data step MAX function wants variable names to be comma delimited:&lt;/P&gt;
&lt;P&gt;y = max(a, b, c);&lt;/P&gt;
&lt;P&gt;If you do not know how many variables you are using then likely an array would be easier&lt;/P&gt;
&lt;PRE&gt;data ll;
   set new_;
   array d__ &amp;amp;dates.;
   date1=max(of d__(*));
   format date1 date9.;
run;&lt;/PRE&gt;
&lt;P&gt;I used a name like d__ for the array as I have no idea what other variables you may have and didn't want a complaint about an error generated because the array name I picked matched an existing variable. If you have a variable named d__ then change the references above to something NOT in your data.&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2020 20:48:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dates/m-p/646243#M193279</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-08T20:48:06Z</dc:date>
    </item>
  </channel>
</rss>

