<?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 char convert to Date format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-char-convert-to-Date-format/m-p/582189#M165547</link>
    <description>&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Mon, 19 Aug 2019 17:39:35 GMT</pubDate>
    <dc:creator>JHE</dc:creator>
    <dc:date>2019-08-19T17:39:35Z</dc:date>
    <item>
      <title>SAS char convert to Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-char-convert-to-Date-format/m-p/582174#M165534</link>
      <description>&lt;P&gt;Good afternoon,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have data set, the date is Char, I need convert to Date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data Set: Test_date&lt;/P&gt;&lt;P&gt;DOB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DOB2&lt;BR /&gt;19380527 1938-05-27&lt;BR /&gt;19720416 1972-04-16&lt;BR /&gt;19400701 1940-07-01&lt;BR /&gt;19520821 1952-08-21&lt;BR /&gt;19451202 1945-12-02&lt;BR /&gt;19320128 1932-01-28&lt;BR /&gt;19410922 1941-09-22&lt;BR /&gt;19620520 1962-05-20&lt;BR /&gt;19310303 1931-03-03&lt;BR /&gt;19300816 1930-08-16&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My SAS program, but do not know this is not working:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data new ;&lt;BR /&gt;set test_date;&lt;BR /&gt;b = (SUBSTR(DOB,1,4)||'-'||SUBSTR(DOB,5,2)||'-'||SUBSTR(DOB,7,2));&lt;BR /&gt;c=input(dob2,mmddyy10.);&lt;BR /&gt;format c mmddyy10.;&lt;BR /&gt;d=datepart(c);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help/ I need convert DOB2 from Char to Date format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 17:15:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-char-convert-to-Date-format/m-p/582174#M165534</guid>
      <dc:creator>JHE</dc:creator>
      <dc:date>2019-08-19T17:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: SAS char convert to Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-char-convert-to-Date-format/m-p/582179#M165538</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input DOB   :$10.        DOB2  :$10. ;
cards;
19380527 1938-05-27
19720416 1972-04-16
19400701 1940-07-01
19520821 1952-08-21
19451202 1945-12-02
19320128 1932-01-28
19410922 1941-09-22
19620520 1962-05-20
19310303 1931-03-03
19300816 1930-08-16
;
data want;
set have;
num_dob=input(dob,yymmdd10.);
num_dob2=input(dob2,yymmdd10.);
format num_dob: date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Aug 2019 17:19:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-char-convert-to-Date-format/m-p/582179#M165538</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-19T17:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: SAS char convert to Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-char-convert-to-Date-format/m-p/582180#M165539</link>
      <description>&lt;P&gt;You can read that character value with the yymmdd8. or yymmdd10 informat depending on which one. Your code shows DOB but you ask about DOB2 so I am not sure what you actually want.&lt;/P&gt;
&lt;P&gt;But consider;&lt;/P&gt;
&lt;PRE&gt;data example;
   input dob yymmdd8.;
   format dob mmddyy10.;
datalines;
19380527 
19720416 
19400701 
19520821 
19451202 
19320128 
19410922 
19620520 
19310303 
19300816 
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Aug 2019 17:20:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-char-convert-to-Date-format/m-p/582180#M165539</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-08-19T17:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS char convert to Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-char-convert-to-Date-format/m-p/582188#M165546</link>
      <description>&lt;P&gt;Thank you. this works.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 17:39:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-char-convert-to-Date-format/m-p/582188#M165546</guid>
      <dc:creator>JHE</dc:creator>
      <dc:date>2019-08-19T17:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: SAS char convert to Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-char-convert-to-Date-format/m-p/582189#M165547</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 17:39:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-char-convert-to-Date-format/m-p/582189#M165547</guid>
      <dc:creator>JHE</dc:creator>
      <dc:date>2019-08-19T17:39:35Z</dc:date>
    </item>
  </channel>
</rss>

