<?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: Regarding date conversion in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172007#M1963</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No. It means at least 5 digits .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 24 Jan 2015 06:47:21 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2015-01-24T06:47:21Z</dc:date>
    <item>
      <title>Regarding date conversion</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172000#M1956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;I'm facing one problem in date variable that is in the date variable some values are in date format and some values are in number format like for example 485959 and 12/08/2014 so i need to bring it to one format that is date format so please can anyone help me out in this i will paste an sample data for your reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sample data is like this&lt;/P&gt;&lt;P&gt;date_of_interview&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="208"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" width="208"&gt;29/08/2013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;29/08/2013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;29/08/2013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;29/08/2013&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;41466&lt;/P&gt;&lt;P&gt;41589&lt;/P&gt;&lt;P&gt;41497&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is from sas file the same data in excel is in correct format.i don't know when i importing to sas its showing like this. please help me out...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your help is highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Anil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2015 11:32:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172000#M1956</guid>
      <dc:creator>anilgvdbm</dc:creator>
      <dc:date>2015-01-07T11:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding date conversion</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172001#M1957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is that variable character type or numeric type ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
 input x : $20.;
cards;
29/08/2013
29/08/2013
29/08/2013
29/08/2013
41466
41589
41497
;
run;
data want;
 set have;
 if prxmatch('/\d{5,}/',x) then new=input(x,mmddyy.);
&amp;nbsp; else new=input(x,anydtdte12.);
 format new ddmmyy8.;
 run;



&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2015 11:53:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172001#M1957</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-01-07T11:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding date conversion</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172002#M1958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well my first suggestion would be to export your data from Excel into a proper data transfer format file, for example CSV or XML.&amp;nbsp; Excel is not for &amp;lt;insert whatever the use is&amp;gt; task.&amp;nbsp; With a properly defined datastep read in of a CSV you will not get this type of problem.&amp;nbsp; What I would imagine is the case is that the format in Excel file is not consistent across cells (hence a good reason why not to use as a data transfer/base/warehouse).&lt;/P&gt;&lt;P&gt;You can create some conditionals to try to convert it in SAS, however would you really want try to handle all the rubbish Excel can throw out at you?&amp;nbsp; What if someone puts in one cell the value 123456789 instead of a date, what happens then?&lt;/P&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt;d="29/08/2013"; output;&lt;/P&gt;&lt;P&gt;d="29/08/2013"; output;&lt;/P&gt;&lt;P&gt;d="29/08/2013"; output;&lt;/P&gt;&lt;P&gt;d="41466"; output;&lt;/P&gt;&lt;P&gt;d="41589"; output;&lt;/P&gt;&lt;P&gt;d="41497"; output;&lt;/P&gt;&lt;P&gt;run; &lt;/P&gt;&lt;P&gt;data temp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; set temp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if length(strip(d)) &amp;lt; 10 then new_date=input(d,best.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; else new_date=input(d,ddmmyy10.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; format new_date date9.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2015 11:54:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172002#M1958</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-01-07T11:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding date conversion</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172003#M1959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear RW9,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here actual problem is the data is entered by the CSPro software .. then i will export from CS pro to SAS direclty.&lt;/P&gt;&lt;P&gt;my data entry operates when they are entering the date variable the mistake they have done is &lt;/P&gt;&lt;P&gt;for example date is 9/12/2014 and 10/12/2014 in between these two dates the length is varies in the first date the length is 9 and 2nd one is 10 so when i import this date into SAS the 2nd date will import as a date and 1st date will import as a sas date number like 45983 .... so what is the exact solution for this problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 05:03:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172003#M1959</guid>
      <dc:creator>anilgvdbm</dc:creator>
      <dc:date>2015-01-23T05:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding date conversion</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172004#M1960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A very simple solution could be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp;&lt;BR /&gt;d="29/08/2013"; output;&lt;BR /&gt;d="29/08/2013"; output;&lt;BR /&gt;d="29/08/2013"; output;&lt;BR /&gt;d="9/12/2014"; output;&lt;BR /&gt;d="10/1/2014"; output;&lt;BR /&gt;d="1/1/2015"; output;&lt;BR /&gt;d="41466"; output;&lt;BR /&gt;d="41589"; output;&lt;BR /&gt;d="41497"; output;&lt;BR /&gt;run; &lt;/P&gt;&lt;P&gt;Data Want;&lt;BR /&gt;&amp;nbsp; Set temp;&lt;BR /&gt;&amp;nbsp; If Find(d,'/') Then Date=MDY(Put(Scan(d,2,'/'),2.),Put(Scan(d,1,'/'),2.),Put(Scan(d,3,'/'),4.));&lt;BR /&gt;&amp;nbsp; Else Date=Put(d,6.)-21916; * your dates start at 1.1.1900 ?;&lt;BR /&gt;&amp;nbsp; Format Date Date9.;&lt;BR /&gt;Run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 06:11:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172004#M1960</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2015-01-23T06:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding date conversion</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172005#M1961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to note, you can shrink your put's down by using anydate:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; index(d,&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;"/"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;) &amp;gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; new_date=datepart(input(d,&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;anydtdtm.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 09:15:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172005#M1961</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-01-23T09:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding date conversion</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172006#M1962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is {5,} in your PRXmatch function denotes 5 digits?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 09:25:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172006#M1962</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-01-23T09:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding date conversion</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172007#M1963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No. It means at least 5 digits .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Jan 2015 06:47:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Regarding-date-conversion/m-p/172007#M1963</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-01-24T06:47:21Z</dc:date>
    </item>
  </channel>
</rss>

