<?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: How to convert text date to sas date where values are different format? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43932#M11533</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Art,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I looked at the last bit of code you posted.&amp;nbsp; It all looks fine except for 2009 converts to 09/01/1920. &lt;/P&gt;&lt;P&gt;I changed the code around a bit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat sdate $10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input sdate&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;Jun-07&lt;/P&gt;&lt;P&gt;Nov-08&lt;/P&gt;&lt;P&gt;14-Jun-07&lt;/P&gt;&lt;P&gt;12-Nov-08&lt;/P&gt;&lt;P&gt;2009&lt;/P&gt;&lt;P&gt;2000&lt;/P&gt;&lt;P&gt;11/01/2009&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format newdate mmddyy10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if length(sdate) = 4 then newdate=mdy(1,1,input(sdate,4.));&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if input(sdate, ? anydtdte21.) then newdate=input(sdate, ? anydtdte21.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if find(sdate,'-') then newdate=input(catx('-','1',sdate),date9.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if find(sdate,'/') then newdate=input(sdate,mmddyy10.);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for all your help.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jerry&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Nov 2011 20:54:00 GMT</pubDate>
    <dc:creator>jerry898969</dc:creator>
    <dc:date>2011-11-08T20:54:00Z</dc:date>
    <item>
      <title>How to convert text date to sas date where values are different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43927#M11528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm have to import an excel spreadsheet that had a date column but the values are not a consistant format.&amp;nbsp; For example :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SDate&lt;/P&gt;&lt;P&gt;------&lt;/P&gt;&lt;P&gt;Jun-07&lt;BR /&gt;Nov-08&lt;BR /&gt;2009&lt;BR /&gt;2000&lt;BR /&gt;11/01/2009&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I try&lt;/P&gt;&lt;DIV class="mcePaste" id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;TABLE border="0" cellpadding="0" cellspacing="0" width="68"&gt;&lt;TBODY&gt;&lt;TR style="height: 11.25pt;"&gt;&lt;TD class="xl67" height="15" style="height: 11.25pt; width: 51pt;" width="68"&gt;Jun-04&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 11.25pt;"&gt;&lt;TD class="xl67" height="15" style="height: 11.25pt;"&gt;Nov-04&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 11.25pt;"&gt;&lt;TD class="xl65" height="15" style="height: 11.25pt;"&gt;2007&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 56.25pt;"&gt;&lt;TD class="xl65" height="75" style="height: 56.25pt;"&gt;2002&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 11.25pt;"&gt;&lt;TD class="xl65" height="15" style="height: 11.25pt;"&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 11.25pt;"&gt;&lt;TD class="xl65" height="15" style="height: 11.25pt;"&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 11.25pt;"&gt;&lt;TD class="xl65" height="15" style="height: 11.25pt;"&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 33.75pt;"&gt;&lt;TD class="xl66" height="45" style="height: 33.75pt; width: 51pt;" width="68"&gt;07/01/2008&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;proc sql ;&lt;BR /&gt;create table xls&lt;BR /&gt;as&lt;BR /&gt;select &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input(sdate, ddmmyy10.) as sdate &lt;BR /&gt;from exl&lt;BR /&gt;;&lt;BR /&gt;quit ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get &lt;/P&gt;&lt;P&gt;NOTE: Invalid date value&lt;BR /&gt;NOTE: Invalid argument to function INPUT. Missing values may be generated.&lt;BR /&gt;NOTE: Table WORK.XLS created, with 5 rows and 1 columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the column is empty except for the last row.&amp;nbsp; Is there a way to apply a default format to all rows?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2011 17:17:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43927#M11528</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2011-11-08T17:17:38Z</dc:date>
    </item>
    <item>
      <title>How to convert text date to sas date where values are different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43928#M11529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;I proposed a couple of methods for very similar data in a presentation last year.&amp;nbsp; Take a look at the powerpoint at: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://torsas.ca/attachments/File/06112010/Worst_Data.ppt"&gt;http://torsas.ca/attachments/File/06112010/Worst_Data.ppt&lt;/A&gt;&lt;SPAN&gt; .&amp;nbsp; Good luck!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2011 17:44:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43928#M11529</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-11-08T17:44:13Z</dc:date>
    </item>
    <item>
      <title>How to convert text date to sas date where values are different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43929#M11530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;informat&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; sdate &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;$10.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; sdate&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;Jun-07&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;Nov-08&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;2009&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;2000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;11/01/2009&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; newdate &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;mmddyy10.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; find(sdate,&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;'-'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; newdate=input(catx(&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;'-'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;'1'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;,sdate),&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;else&lt;/SPAN&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; find(sdate,&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;'/'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; newdate=input(sdate,&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;mmddyy10.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;else&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; newdate=mdy(&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;,input(sdate,&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;4.&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2011 19:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43929#M11530</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2011-11-08T19:28:04Z</dc:date>
    </item>
    <item>
      <title>How to convert text date to sas date where values are different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43930#M11531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very close!&amp;nbsp; But I would preface the if statements with one to catch actual dates that were readable with the anydtdte informat.&amp;nbsp; E.g.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat sdate $10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input sdate&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;Jun-07&lt;/P&gt;&lt;P&gt;Nov-08&lt;/P&gt;&lt;P&gt;14-Jun-07&lt;/P&gt;&lt;P&gt;12-Nov-08&lt;/P&gt;&lt;P&gt;2009&lt;/P&gt;&lt;P&gt;2000&lt;/P&gt;&lt;P&gt;11/01/2009&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format newdate mmddyy10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if input(sdate, ? anydtdte21.) then newdate=input(sdate, ? anydtdte21.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if find(sdate,'-') then newdate=input(catx('-','1',sdate),date9.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if find(sdate,'/') then newdate=input(sdate,mmddyy10.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else newdate=mdy(1,1,input(sdate,4.));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2011 19:39:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43930#M11531</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-11-08T19:39:13Z</dc:date>
    </item>
    <item>
      <title>How to convert text date to sas date where values are different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43931#M11532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi Art297,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp; I have looked at your powerpoint, it is very helpful!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2011 19:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43931#M11532</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2011-11-08T19:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert text date to sas date where values are different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43932#M11533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Art,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I looked at the last bit of code you posted.&amp;nbsp; It all looks fine except for 2009 converts to 09/01/1920. &lt;/P&gt;&lt;P&gt;I changed the code around a bit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat sdate $10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input sdate&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;Jun-07&lt;/P&gt;&lt;P&gt;Nov-08&lt;/P&gt;&lt;P&gt;14-Jun-07&lt;/P&gt;&lt;P&gt;12-Nov-08&lt;/P&gt;&lt;P&gt;2009&lt;/P&gt;&lt;P&gt;2000&lt;/P&gt;&lt;P&gt;11/01/2009&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format newdate mmddyy10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if length(sdate) = 4 then newdate=mdy(1,1,input(sdate,4.));&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if input(sdate, ? anydtdte21.) then newdate=input(sdate, ? anydtdte21.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if find(sdate,'-') then newdate=input(catx('-','1',sdate),date9.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if find(sdate,'/') then newdate=input(sdate,mmddyy10.);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for all your help.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jerry&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2011 20:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43932#M11533</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2011-11-08T20:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert text date to sas date where values are different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43933#M11534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As long as you got what you needed.&amp;nbsp; When I run that type of code I also typicallly set the system option "datestyle" the type most prevalent form the data has.&amp;nbsp; e.g.,&lt;/P&gt;&lt;P&gt;options datestyle=mdy;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, it always helps if one ensures that their year cutoff option is set appropriately for the current year.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2011 22:30:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43933#M11534</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-11-08T22:30:01Z</dc:date>
    </item>
    <item>
      <title>How to convert text date to sas date where values are different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43934#M11535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;options datestyle=mdy;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;format sdate yymmdd10.;&lt;/P&gt;&lt;P&gt;informat sdate anydtdte10.;&lt;/P&gt;&lt;P&gt;input @;&lt;/P&gt;&lt;P&gt; if length(_infile_)=4 then _infile_='01-01-'||_infile_;&lt;/P&gt;&lt;P&gt;input sdate;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;Jun-07&lt;/P&gt;&lt;P&gt;Nov-08&lt;/P&gt;&lt;P&gt;14-Jun-07&lt;/P&gt;&lt;P&gt;12-Nov-08&lt;/P&gt;&lt;P&gt;2009&lt;/P&gt;&lt;P&gt;2000&lt;/P&gt;&lt;P&gt;11/01/2009&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2011 23:24:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43934#M11535</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2011-11-08T23:24:26Z</dc:date>
    </item>
    <item>
      <title>How to convert text date to sas date where values are different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43935#M11536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;FriedEgg:&amp;nbsp; Very nice!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2011 23:28:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43935#M11536</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-11-08T23:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert text date to sas date where values are different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43936#M11537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you everyone for all your help.&amp;nbsp; All your input helped.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 14:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43936#M11537</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2011-11-09T14:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert text date to sas date where values are different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43937#M11538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;FriedEgg,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried doing the following code which is coming from a sas data set&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options datestyle=mdy;&lt;/P&gt;&lt;P&gt;data tab1 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set tab0 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; informat sdate anydtdte10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format sdate&amp;nbsp;&amp;nbsp; yymmdd10.;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if length(sdate)=4 then sdate='01-01-'||sdate;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;run ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I keep getting the following errors.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR 48-59: The informat $ANYDTDTE was not found or could not be loaded.&lt;/P&gt;&lt;P&gt;ERROR 48-59: The format $YYMMDD was not found or could not be loaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently sdate is text in the data table that is being set.&amp;nbsp; I have it working using the code that art posted but I just realized I have more then one column with data like this so I don't want to use if's for every variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for any more help you can give me&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 15:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43937#M11538</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2011-11-09T15:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert text date to sas date where values are different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43938#M11539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jerry,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You apparently first read sdate in as a character variable.&amp;nbsp; As such, your probably have to run something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data tab0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat sdate $10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input sdate;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;Jun-07&lt;/P&gt;&lt;P&gt;Nov-08&lt;/P&gt;&lt;P&gt;14-Jun-07&lt;/P&gt;&lt;P&gt;12-Nov-08&lt;/P&gt;&lt;P&gt;2009&lt;/P&gt;&lt;P&gt;2000&lt;/P&gt;&lt;P&gt;11/01/2009&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options datestyle=mdy;&lt;/P&gt;&lt;P&gt;data tab1 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set tab0 (rename=(sdate=sdate_in));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format sdate&amp;nbsp;&amp;nbsp; yymmdd10.;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if length(sdate_in)=4 then sdate_in='01-01-'||sdate_in;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sdate=input(sdate_in,anydtdte10.);&lt;/P&gt;&lt;P&gt;run ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 15:25:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43938#M11539</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-11-09T15:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert text date to sas date where values are different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43939#M11540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Art and Fried, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just a question regarding options datestyle=mdy; do I need to use it for using anydtdte informat option or is that option for something else ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks &lt;BR /&gt;kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 15:50:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43939#M11540</guid>
      <dc:creator>Phaani</dc:creator>
      <dc:date>2011-11-09T15:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert text date to sas date where values are different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43940#M11541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Need to: no!&amp;nbsp; Advisable: yes!&amp;nbsp; Why make SAS guess if you know the true order of the month, day and year components?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 16:47:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43940#M11541</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-11-09T16:47:17Z</dc:date>
    </item>
    <item>
      <title>How to convert text date to sas date where values are different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43941#M11542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://communities.sas.com/people/Phaani" id="jive-7243621343447072963803" style="background-color: #f9f9f9; color: #0e66ba; font-weight: bold; text-align: center;"&gt;Phaani&lt;/A&gt; wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hello Art and Fried, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just a question regarding options datestyle=mdy; do I need to use it for using anydtdte informat option or is that option for something else ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks &lt;BR /&gt;kumar&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The datestyle system option tells the anydt* formats what style date to use as a default when it cannot determine the proper order for the given date.&amp;nbsp; For instance in this example we have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;11/01/2009&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This could be November 1st 2009 or January 11th 2009, I want is to be Nov. 1 so I assign datestyle=mdy.&amp;nbsp; With bad data always comes mistakes and assumptions so this should be assigned to the occurance you view as being most frequent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://communities.sas.com/people/jerry898969" id="jive-54897621343447066387803" style="background-color: #e0eaf3; color: #0e66ba; font-weight: bold; text-align: center;"&gt;jerry898969&lt;/A&gt; wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #eef4f9;"&gt;ERROR 48-59: The informat $ANYDTDTE was not found or could not be loaded.&lt;/P&gt;&lt;P style="background-color: #eef4f9;"&gt;ERROR 48-59: The format $YYMMDD was not found or could not be loaded.&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I avoid this issue by using the special _infile_ variable, if you are changing the format from a dataset you will need to use input function for my method.&amp;nbsp; Art's post would be my solution for this situation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 17:10:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-convert-text-date-to-sas-date-where-values-are-different/m-p/43941#M11542</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2011-11-09T17:10:13Z</dc:date>
    </item>
  </channel>
</rss>

