<?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: Proc import with excel date field in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42259#M10951</link>
    <description>Jerry,&lt;BR /&gt;
&lt;BR /&gt;
You missed an important word in Reeza's response, assuming you are on Windows, you have to change the setting in the Registry.&lt;BR /&gt;
&lt;BR /&gt;
A couple of years ago Datanull posted a solution, on SAS-L, for doing just that.  You can find the post at: &lt;A href="http://xrl.us/bfa8qi" target="_blank"&gt;http://xrl.us/bfa8qi&lt;/A&gt; or, in long form,&lt;BR /&gt;
&lt;A href="http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0811b&amp;amp;L=sas-l&amp;amp;D=1&amp;amp;O=A&amp;amp;P=41923" target="_blank"&gt;http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0811b&amp;amp;L=sas-l&amp;amp;D=1&amp;amp;O=A&amp;amp;P=41923&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
HTH,&lt;BR /&gt;
Art</description>
    <pubDate>Fri, 01 Apr 2011 19:05:32 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2011-04-01T19:05:32Z</dc:date>
    <item>
      <title>Proc import with excel date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42250#M10942</link>
      <description>I'm using proc import to import some data from excel.  I have two date columns date1 and date2.  After I do my import my data table has both columns except date1 is $10 and date2 is a number.  Within excel both columns have the same format.  &lt;BR /&gt;
The only thing I can see different is that date2 has more data in the column then date1.&lt;BR /&gt;
&lt;BR /&gt;
This is my proc import:&lt;BR /&gt;
&lt;BR /&gt;
PROC IMPORT OUT= dts&lt;BR /&gt;
            DATAFILE= "C:\temp.XLS" &lt;BR /&gt;
            DBMS=EXCEL REPLACE;&lt;BR /&gt;
     SHEET="sheet1"; &lt;BR /&gt;
     GETNAMES=YES;&lt;BR /&gt;
     MIXED=NO;&lt;BR /&gt;
     SCANTEXT=YES;&lt;BR /&gt;
     USEDATE=YES;&lt;BR /&gt;
     SCANTIME=YES;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
Thank you</description>
      <pubDate>Thu, 31 Mar 2011 20:51:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42250#M10942</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2011-03-31T20:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with excel date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42251#M10943</link>
      <description>If you could provide the first few lines in the excel file, that would be helpful to find the problem. I think date2 is correct as it shows the number, if you can format that to date format (yyddmm.10) you might be able to see the desired date.&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Thu, 31 Mar 2011 21:04:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42251#M10943</guid>
      <dc:creator>SAS83</dc:creator>
      <dc:date>2011-03-31T21:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with excel date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42252#M10944</link>
      <description>Change mixed to yes and make sure your excel file has the date format applied as a format. &lt;BR /&gt;
&lt;BR /&gt;
Then apply the date format in SAS.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ie.&lt;BR /&gt;
data want;&lt;BR /&gt;
set have;&lt;BR /&gt;
format date1 date2 date9.;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
If you want to convert the date to a date in SAS instead look up the anydttm format(might be missing a few letters there). &lt;BR /&gt;
&lt;BR /&gt;
HTH,&lt;BR /&gt;
Reeza

Message was edited by: Reeza</description>
      <pubDate>Thu, 31 Mar 2011 23:50:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42252#M10944</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2011-03-31T23:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with excel date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42253#M10945</link>
      <description>SAS83 and Reeza,&lt;BR /&gt;
&lt;BR /&gt;
Thank you both for your replies.  &lt;BR /&gt;
&lt;BR /&gt;
I can not post any of the data i'm working with.  It's sensitive data.&lt;BR /&gt;
&lt;BR /&gt;
I can get around it like this&lt;BR /&gt;
data  temp2;&lt;BR /&gt;
	format date1_dt date9.;&lt;BR /&gt;
	set temp ;&lt;BR /&gt;
	date1_dt = input(date,anydtdte.);&lt;BR /&gt;
run ;&lt;BR /&gt;
&lt;BR /&gt;
I'm trying to figure out how to make the import make the table a number like date2 so I don't have to do this step.</description>
      <pubDate>Fri, 01 Apr 2011 12:41:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42253#M10945</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2011-04-01T12:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with excel date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42254#M10946</link>
      <description>A work around is always good. &lt;BR /&gt;
&lt;BR /&gt;
You don't need to post actual data, but what the data looks like in Excel&lt;BR /&gt;
&lt;BR /&gt;
ie &lt;BR /&gt;
date1 date2&lt;BR /&gt;
March 31, 2001 3-31-2001&lt;BR /&gt;
&lt;BR /&gt;
or &lt;BR /&gt;
date1 date2&lt;BR /&gt;
3/31/01 20110331&lt;BR /&gt;
&lt;BR /&gt;
There are many ways that dates could be formatted and without 'seeing' it almost impossible to offer any better suggestions.</description>
      <pubDate>Fri, 01 Apr 2011 16:01:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42254#M10946</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2011-04-01T16:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with excel date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42255#M10947</link>
      <description>Reeza,&lt;BR /&gt;
&lt;BR /&gt;
I'm sorry I misunderstood the question.  Here is some example data&lt;BR /&gt;
I don't have a date for date1 till row 52 of my spreadsheet. date2 starts on row 7.&lt;BR /&gt;
&lt;BR /&gt;
date1         &lt;BR /&gt;
1/1/1940&lt;BR /&gt;
&lt;BR /&gt;
date2&lt;BR /&gt;
1/9/2006&lt;BR /&gt;
1/27/2007&lt;BR /&gt;
&lt;BR /&gt;
1/11/2009&lt;BR /&gt;
1/17/2010	&lt;BR /&gt;
1/21/2001	&lt;BR /&gt;
1/7/2001	&lt;BR /&gt;
&lt;BR /&gt;
1/23/2010&lt;BR /&gt;
1/18/2000&lt;BR /&gt;
	&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
1/1/2005</description>
      <pubDate>Fri, 01 Apr 2011 16:22:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42255#M10947</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2011-04-01T16:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with excel date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42256#M10948</link>
      <description>Its the date not starting until row 52 that's causing the problems then. &lt;BR /&gt;
&lt;BR /&gt;
One workaround is to save as csv and import using proc import. Get the code from the log and modify the date1 field.&lt;BR /&gt;
&lt;BR /&gt;
OR&lt;BR /&gt;
&lt;BR /&gt;
Sort your excel sheet such that the missings are at the end&lt;BR /&gt;
&lt;BR /&gt;
OR&lt;BR /&gt;
&lt;BR /&gt;
change your guessing rows settings in registry&lt;BR /&gt;
&lt;BR /&gt;
and the easiest by far...&lt;BR /&gt;
&lt;BR /&gt;
read it in and then convert :). &lt;BR /&gt;
&lt;BR /&gt;
HTH,&lt;BR /&gt;
Reeza</description>
      <pubDate>Fri, 01 Apr 2011 18:00:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42256#M10948</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2011-04-01T18:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with excel date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42257#M10949</link>
      <description>Put some dummy dates and then use if statements to make them as null or period.&lt;BR /&gt;
&lt;BR /&gt;
eg: fill the empty cells with dymmy date which is unique.. like : &lt;BR /&gt;
01011968 then use&lt;BR /&gt;
&lt;BR /&gt;
if date1="01011968.d" then date1=.;&lt;BR /&gt;
I think best option is to sort it as suggested by Reeza. That is the safe option.</description>
      <pubDate>Fri, 01 Apr 2011 18:14:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42257#M10949</guid>
      <dc:creator>SAS83</dc:creator>
      <dc:date>2011-04-01T18:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with excel date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42258#M10950</link>
      <description>Reeza,&lt;BR /&gt;
&lt;BR /&gt;
Thank you for your help.  I already have my typeguessrow set to 0 and it still doesn't work.&lt;BR /&gt;
&lt;BR /&gt;
It is supposed to scan over 16000 rows and decide on the type.  The majory have a format of "General" and the date cells have a date format.&lt;BR /&gt;
&lt;BR /&gt;
Still doesn't work.  &lt;BR /&gt;
&lt;BR /&gt;
If a column is mostly blank I would assume they would make it the type of the data that is in the column.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again for all your help and suggestions.</description>
      <pubDate>Fri, 01 Apr 2011 18:29:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42258#M10950</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2011-04-01T18:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with excel date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42259#M10951</link>
      <description>Jerry,&lt;BR /&gt;
&lt;BR /&gt;
You missed an important word in Reeza's response, assuming you are on Windows, you have to change the setting in the Registry.&lt;BR /&gt;
&lt;BR /&gt;
A couple of years ago Datanull posted a solution, on SAS-L, for doing just that.  You can find the post at: &lt;A href="http://xrl.us/bfa8qi" target="_blank"&gt;http://xrl.us/bfa8qi&lt;/A&gt; or, in long form,&lt;BR /&gt;
&lt;A href="http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0811b&amp;amp;L=sas-l&amp;amp;D=1&amp;amp;O=A&amp;amp;P=41923" target="_blank"&gt;http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0811b&amp;amp;L=sas-l&amp;amp;D=1&amp;amp;O=A&amp;amp;P=41923&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
HTH,&lt;BR /&gt;
Art</description>
      <pubDate>Fri, 01 Apr 2011 19:05:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42259#M10951</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-04-01T19:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with excel date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42260#M10952</link>
      <description>Art,&lt;BR /&gt;
&lt;BR /&gt;
Thank you for your response.  &lt;BR /&gt;
&lt;BR /&gt;
When I said "typeguessrow set to 0" in my post I assumed that Reeza knew I was doing it in the registry.  I had already made this change in the past.  It didn't fix the issue.&lt;BR /&gt;
&lt;BR /&gt;
thanks</description>
      <pubDate>Fri, 01 Apr 2011 19:36:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42260#M10952</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2011-04-01T19:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import with excel date field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42261#M10953</link>
      <description>Did you try setting the registry to the highest number possible rather than 0?</description>
      <pubDate>Fri, 01 Apr 2011 20:22:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-with-excel-date-field/m-p/42261#M10953</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-04-01T20:22:13Z</dc:date>
    </item>
  </channel>
</rss>

