<?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: SAS Date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735605#M229158</link>
    <description>ballardw thankyou, this makes a lot of things clearer to me now. I will go back and have a look.&lt;BR /&gt;Cheers</description>
    <pubDate>Tue, 20 Apr 2021 15:18:31 GMT</pubDate>
    <dc:creator>EM_G</dc:creator>
    <dc:date>2021-04-20T15:18:31Z</dc:date>
    <item>
      <title>SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735419#M229098</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know the topic of converting char var to sas dates has been covered a lot. Looking through the previous posts I have not found the answer to my question.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have dates in the format of 01Jan2014 and trying to compute a new column with the sas date as follows:&lt;/P&gt;&lt;P&gt;data new;&lt;/P&gt;&lt;P&gt;set have (rename=(date=old));&lt;/P&gt;&lt;P&gt;date = input (old,date9.);&lt;/P&gt;&lt;P&gt;drop old;&lt;/P&gt;&lt;P&gt;format date mmddyy10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;The log comes back as Note; Invalid argument to function input at line 64 in column 10&lt;/P&gt;&lt;P&gt;Why could I be getting this error?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 05:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735419#M229098</guid>
      <dc:creator>EM_G</dc:creator>
      <dc:date>2021-04-20T05:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735426#M229100</link>
      <description>&lt;P&gt;Difficult to help without seeing data and log. Maybe you don't have a proper date-string in some lines.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 06:03:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735426#M229100</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-04-20T06:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735447#M229110</link>
      <description>&lt;P&gt;Look at the attributes of your existing date column. Is it in fact character?&lt;/P&gt;
&lt;P&gt;Please post the log of the data step, including the complete code and the NOTE. It will contain a listing of the variable values at the time of the conversion problem.&lt;/P&gt;
&lt;P&gt;Use this button to post the log:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54552i914D97BE1B0F21E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 08:36:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735447#M229110</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-20T08:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735597#M229154</link>
      <description>&lt;P&gt;You log also likely showed the value it attempted to read in that invalid data message.&lt;/P&gt;
&lt;P&gt;Here is an example of a bad date string and what the log shows when you use the input function similar to your example:&lt;/P&gt;
&lt;PRE&gt;26   data junk;
27      strdate='03JON2021';
28   run;

NOTE: The data set WORK.JUNK has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


29   data junk2;
30      set junk;
31      date = input(strdate,date9.);
32   run;

NOTE: Invalid argument to function INPUT at line 31 column 11.
strdate=03JON2021 date=. _ERROR_=1 _N_=1
NOTE: Mathematical operations could not be performed at the following places. The results of the
      operations have been set to missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1 at 31:11
&lt;/PRE&gt;
&lt;P&gt;So you have cleverly hidden the actual problem value by not pasting the SECOND line of the Invalid argument note.&lt;/P&gt;
&lt;P&gt;If you read your log carefully I strongly suspect you will find the problem dates are most likely to days of the month that are not valid like 31 November, or leap days for February in non-leap years.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 14:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735597#M229154</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-20T14:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735605#M229158</link>
      <description>ballardw thankyou, this makes a lot of things clearer to me now. I will go back and have a look.&lt;BR /&gt;Cheers</description>
      <pubDate>Tue, 20 Apr 2021 15:18:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735605#M229158</guid>
      <dc:creator>EM_G</dc:creator>
      <dc:date>2021-04-20T15:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735620#M229164</link>
      <description>You are right that the log also says date=._ERROR_=1 _N_=1 all the way through to _N_=20 where limit set Errors are reached. They all happen to have the same original date old=01SEP2017. Could it be the uppercase SEP? Or; the original dataset was imported from excel, in excel the date was 1-SEP-2017, but when I imported it, SAS automatically formatted it to 01SEP2017, could the problem be here somewhere?</description>
      <pubDate>Tue, 20 Apr 2021 15:38:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735620#M229164</guid>
      <dc:creator>EM_G</dc:creator>
      <dc:date>2021-04-20T15:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735635#M229167</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353220"&gt;@EM_G&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;You are right that the log also says date=._ERROR_=1 _N_=1 all the way through to _N_=20 where limit set Errors are reached. They all happen to have the same original date old=01SEP2017. Could it be the uppercase SEP? Or; the original dataset was imported from excel, in excel the date was 1-SEP-2017, but when I imported it, SAS automatically formatted it to 01SEP2017, could the problem be here somewhere?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It looks like the variable is already a numeric variable with the DATE9. format attached to it.&amp;nbsp; That would display date values in that style. So what are you trying to convert?&amp;nbsp; If you want the dates displayed differently then just use a different format with the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at the definition of the variable in the SAS dataset. (for example run PROC CONTENTS on it)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 16:07:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735635#M229167</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-04-20T16:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735654#M229169</link>
      <description>I would like it as a sas date. Can it be a sas date, but displayed as a format easier to recognise?</description>
      <pubDate>Tue, 20 Apr 2021 16:26:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735654#M229169</guid>
      <dc:creator>EM_G</dc:creator>
      <dc:date>2021-04-20T16:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735673#M229173</link>
      <description>&lt;P&gt;Which of the 285 formats to you find more readable?&lt;/P&gt;
&lt;PRE&gt;2321  data test;
2322    today=date();
2323    set sashelp.vformat ;
2324    where fmttype='F' and fmtinfo(fmtname,'cat')='date';
2325    if fmtname ^=: '$';
2326    value = putn(today,cats(fmtname,maxw,'.-L'));
2327    if compress(value,'*') ne ' ';
2328    keep fmtname value;
2329  run;

NOTE: There were 310 observations read from the data set SASHELP.VFORMAT.
      WHERE (fmttype='F') and (FMTINFO(fmtname, 'cat')='date');
NOTE: The data set WORK.TEST has 285 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.54 seconds
      cpu time            0.39 seconds
&lt;/PRE&gt;
&lt;P&gt;Personally I like to use YYMMDD10.&amp;nbsp; Then the value will sort lexigraphically in chronological order.&amp;nbsp; Plus unlike MMDDYY or DDMMYY you don't confuse half of your audience when the day number is 12 or less.&amp;nbsp; &amp;nbsp;Does 10/12 mean October 12th or 10th December?&amp;nbsp; If you like the style your Excel sheet was using then try DATE11. to get hyphens.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 17:05:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date/m-p/735673#M229173</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-04-20T17:05:22Z</dc:date>
    </item>
  </channel>
</rss>

