<?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: help in my sql code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/629269#M186059</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;SPAN&gt;&lt;FONT size="3"&gt;谢谢&lt;/FONT&gt; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Mar 2020 20:40:33 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2020-03-03T20:40:33Z</dc:date>
    <item>
      <title>help in my sql code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/628833#M185877</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am getting the below messages in the log when i run the pgm. Please suggest how to avoid the messages. Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Invalid date value&lt;BR /&gt;NOTE: Invalid argument to function INPUT. Missing values may be generated.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id date $16.;
datalines;
1 2019-12-17T13:30
1 2020-01-16T12:15
1 
1 2019-12-19T14:25
;

proc sql noprint;
create table want as
select distinct id,
case 
when not missing(date) then max(input(substr(date,1,10),is8601da.)) 
end as edt format = yymmdd10.
from have   
group by id
order by id;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Mar 2020 16:53:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/628833#M185877</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2020-03-02T16:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: help in my sql code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/628836#M185879</link>
      <description>&lt;P&gt;3rd record has no date.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 17:00:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/628836#M185879</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2020-03-02T17:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: help in my sql code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/628837#M185880</link>
      <description>also, I think you want this for edt:&lt;BR /&gt;&lt;BR /&gt;max(case &lt;BR /&gt;when not missing(date) then input(substr(date,1,10),is8601da.) &lt;BR /&gt;end) as edt format = yymmdd10.</description>
      <pubDate>Mon, 02 Mar 2020 17:02:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/628837#M185880</guid>
      <dc:creator>tomrvincent</dc:creator>
      <dc:date>2020-03-02T17:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: help in my sql code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/628838#M185881</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm not really sure what your desired output is, but this code simplifies a lot of what you were attempting to do. I'm just not sure how you wanted to handle the missing value. In SAS, missing values are treated like negative infinity, so any date will be larger than the missing date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;&lt;BR /&gt;infile datalines missover;&lt;BR /&gt;input id date : yymmdd10.;&lt;BR /&gt;datalines;&lt;BR /&gt;1 2019-12-17T13:30&lt;BR /&gt;1 2020-01-16T12:15&lt;BR /&gt;1 &lt;BR /&gt;1 2019-12-19T14:25&lt;BR /&gt;;&lt;BR /&gt;proc print; &lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;create table want as&lt;BR /&gt;select distinct id,&lt;BR /&gt;max(date) as edt format = yymmdd10.&lt;BR /&gt;from have   &lt;BR /&gt;group by id&lt;BR /&gt;order by id;&lt;BR /&gt;quit;&lt;/PRE&gt;
&lt;P&gt;Michelle&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 17:07:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/628838#M185881</guid>
      <dc:creator>mbuchecker</dc:creator>
      <dc:date>2020-03-02T17:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: help in my sql code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/628894#M185896</link>
      <description>&lt;P&gt;You SQL could also be&lt;/P&gt;
&lt;PRE&gt;proc sql ;&lt;BR /&gt;  create table WANT as&lt;BR /&gt;    select distinct ID&lt;BR /&gt;   ,max(input(DATE,?? is8601da.)) as EDT format = yymmdd10.&lt;BR /&gt;  from HAVE&lt;BR /&gt;  group by ID&lt;BR /&gt;  order by ID;&lt;BR /&gt;quit;&lt;/PRE&gt;
&lt;P&gt;The width of &lt;A href="https://documentation.sas.com/?docsetId=leforinforref&amp;amp;docsetTarget=p04m4y13fs0wj9n1rxx4d2330nkr.htm&amp;amp;docsetVersion=3.1&amp;amp;locale=en" target="_self"&gt;informat&amp;nbsp;&lt;FONT face="courier new,courier"&gt;is8601da.&lt;/FONT&gt;&lt;/A&gt; is 10.&lt;/P&gt;
&lt;P&gt;The ?? &lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p19en16vskd2vhn1vwmxpxnglxxs.htm&amp;amp;docsetVersion=3.1&amp;amp;locale=en" target="_self"&gt;takes care&lt;/A&gt; of bad dates.&lt;/P&gt;
&lt;P&gt;Function &lt;FONT face="courier new,courier"&gt;max()&lt;/FONT&gt; will keep any date at all as missing dates are the smallest.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 19:48:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/628894#M185896</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-03-02T19:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: help in my sql code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/629012#M185949</link>
      <description>&lt;P&gt;If I reckon right, ?? is invalid in SQL . ?? only work in Data step .&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 03:43:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/629012#M185949</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-03-03T03:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: help in my sql code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/629015#M185951</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;If I reckon right, ?? is invalid in SQL . ?? only work in Data step .&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oh...&amp;nbsp; I didn't remember that and I can't test. I haven't had SAS for weeks now, still awaiting the deployment...&lt;/P&gt;
&lt;P&gt;Any other function that behaves differently? I know some&amp;nbsp;functions&amp;nbsp; cannot be used, such a peek or lag or symput, but different syntaxes is another level altogether.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 03:55:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/629015#M185951</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-03-03T03:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: help in my sql code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/629019#M185953</link>
      <description>&lt;P&gt;Ha, Chris Here is the LOG.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; 79         proc sql ;
 80           create table WANT as
 81             select distinct ID
 82            ,max(input(DATE,?? is8601da.)) as EDT format = yymmdd10.
                                _
                                22
                                200
 ERROR 22-322: 期望: 格式名.  
 
 ERROR 200-322: 该符号不可识别，将被忽略。&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Mar 2020 04:42:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/629019#M185953</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-03-03T04:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: help in my sql code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/629269#M186059</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;SPAN&gt;&lt;FONT size="3"&gt;谢谢&lt;/FONT&gt; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 20:40:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/help-in-my-sql-code/m-p/629269#M186059</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-03-03T20:40:33Z</dc:date>
    </item>
  </channel>
</rss>

