<?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: Date format assistance in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-format-assistance/m-p/507012#M135989</link>
    <description>&lt;P&gt;What about:&lt;/P&gt;
&lt;P&gt;format date1 ddmmyyn8.;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Oct 2018 20:57:09 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2018-10-23T20:57:09Z</dc:date>
    <item>
      <title>Date format assistance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-assistance/m-p/507009#M135987</link>
      <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;length&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Group $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;50&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Group $ _NAME_ $ Value date $;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;wwww AARP 50 1jun2018&lt;/P&gt;
&lt;P&gt;2fff BBRP 123 5may2015&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;date1 = input(date,&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;anydtdte11.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; date1 &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;I am attempting to change the date format to read as a DDMMMYYYY format.&amp;nbsp; I tried several combinations including&lt;/P&gt;
&lt;P&gt;format date1 ddmmmyyyy10.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 20:52:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-assistance/m-p/507009#M135987</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2018-10-23T20:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Date format assistance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-assistance/m-p/507012#M135989</link>
      <description>&lt;P&gt;What about:&lt;/P&gt;
&lt;P&gt;format date1 ddmmyyn8.;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 20:57:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-assistance/m-p/507012#M135989</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-10-23T20:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: Date format assistance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-assistance/m-p/507013#M135990</link>
      <description>&lt;P&gt;In an INPUT statement you need an INFORMAT, which should reflect what the date looks like.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This works for me. Please put your code in a code block in the future, it helps avoid issues when copy/pasting for testing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
length Group $50;
input Group $ _NAME_ $ Value date $; 
datalines;
wwww AARP 50 1jun2018
2fff BBRP 123 5may2015
;                   
run;

data have1;
set have;
date1 = input(date,&lt;FONT size="5" color="#800080"&gt;&lt;STRONG&gt;date9.&lt;/STRONG&gt;&lt;/FONT&gt;);
format date1 date9.;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Oct 2018 21:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-assistance/m-p/507013#M135990</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-23T21:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Date format assistance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-assistance/m-p/507037#M136007</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Or, as an alternative, you could use an INFORMAT directly in the INPUT statement:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alt_informat.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24342iB5AC50A45D74DA8E/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt_informat.png" alt="alt_informat.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Either approach will work. I tend to use ANYDTDTE if I'm not certain that all the date values in the DATALINES appear the same.&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 23:09:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-assistance/m-p/507037#M136007</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-10-23T23:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Date format assistance</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format-assistance/m-p/507039#M136008</link>
      <description>&lt;P&gt;You didn't define a length for your character variable DATE. So SAS will default it to length $8, which will truncate values with two digit days and four digit years.&amp;nbsp; &amp;nbsp;Not sure why you defined a length for one of your variables but not the other three. Best to define the lengths yourself and not force SAS to guess at what you want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  length Group $50 _name_ $32 value 8 date $11;
  input Group _NAME_ Value date;
datalines;
wwww AARP 50 11jun2018
2fff BBRP 123 15-may-2015
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hopefully your real character variable is at least 9 characters long (or 11 if the date strings have punctuation around the month code).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
  set have;
  length date1 8;
  date1 = input(date,date11.);
  format date1 date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    Group    _name_    value       date            date1

 1     wwww      AARP       50     11jun2018      11JUN2018
 2     2fff      BBRP      123     15-may-2015    15MAY2015&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Oct 2018 00:20:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format-assistance/m-p/507039#M136008</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-10-24T00:20:49Z</dc:date>
    </item>
  </channel>
</rss>

