<?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 Proc Import Peculiarity in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Import-Peculiarity/m-p/42576#M11077</link>
    <description>Someone asked this on SAS-L this morning and I'm wondering if my discussion forum colleagues might have an answer.&lt;BR /&gt;
&lt;BR /&gt;
Suppose you had/created the following tab delimited file:&lt;BR /&gt;
&lt;BR /&gt;
filename testdata "c:\testdata.txt";&lt;BR /&gt;
data _null_;&lt;BR /&gt;
  file testdata;&lt;BR /&gt;
  length thedata $15;&lt;BR /&gt;
  input thedata;&lt;BR /&gt;
  put thedata @;&lt;BR /&gt;
  if mod(_n_,4) eq 0 then put;&lt;BR /&gt;
  else put "09"x @;&lt;BR /&gt;
  cards;&lt;BR /&gt;
StudyNumber&lt;BR /&gt;
vara&lt;BR /&gt;
varb&lt;BR /&gt;
varc&lt;BR /&gt;
"1001"&lt;BR /&gt;
"1"&lt;BR /&gt;
"a"&lt;BR /&gt;
"b"&lt;BR /&gt;
"1002"&lt;BR /&gt;
"1"&lt;BR /&gt;
"a"&lt;BR /&gt;
"b"&lt;BR /&gt;
"1003"&lt;BR /&gt;
"1"&lt;BR /&gt;
"a"&lt;BR /&gt;
"b"&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Using the following code to import the file results in a file where StudyNumber is imported as a datetime field:&lt;BR /&gt;
&lt;BR /&gt;
proc import datafile="c:\testdata.txt"&lt;BR /&gt;
     dbms=dlm out=work.test&lt;BR /&gt;
  replace;&lt;BR /&gt;
  delimiter='09'x;&lt;BR /&gt;
  getnames=yes;&lt;BR /&gt;
  guessingrows=32767;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Interestingly, if one changes the first data record to have a StudyNumber of "301001" the file imports correctly.&lt;BR /&gt;
&lt;BR /&gt;
Since the OP needs to import 100s of files, he doesn't want to replace proc import with datastep code.&lt;BR /&gt;
&lt;BR /&gt;
Anyone have a clue as to why proc import is functioning that way and any direct way to change its behavior?&lt;BR /&gt;
&lt;BR /&gt;
Art&lt;BR /&gt;
&lt;BR /&gt;
p.s. I'm looking forward to finally meeting some of you in Vegas next week, especially at the combined SAS-L / SAS Discussion Forums / sasCommunity.org meetup.</description>
    <pubDate>Fri, 01 Apr 2011 18:05:38 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2011-04-01T18:05:38Z</dc:date>
    <item>
      <title>Proc Import Peculiarity</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Import-Peculiarity/m-p/42576#M11077</link>
      <description>Someone asked this on SAS-L this morning and I'm wondering if my discussion forum colleagues might have an answer.&lt;BR /&gt;
&lt;BR /&gt;
Suppose you had/created the following tab delimited file:&lt;BR /&gt;
&lt;BR /&gt;
filename testdata "c:\testdata.txt";&lt;BR /&gt;
data _null_;&lt;BR /&gt;
  file testdata;&lt;BR /&gt;
  length thedata $15;&lt;BR /&gt;
  input thedata;&lt;BR /&gt;
  put thedata @;&lt;BR /&gt;
  if mod(_n_,4) eq 0 then put;&lt;BR /&gt;
  else put "09"x @;&lt;BR /&gt;
  cards;&lt;BR /&gt;
StudyNumber&lt;BR /&gt;
vara&lt;BR /&gt;
varb&lt;BR /&gt;
varc&lt;BR /&gt;
"1001"&lt;BR /&gt;
"1"&lt;BR /&gt;
"a"&lt;BR /&gt;
"b"&lt;BR /&gt;
"1002"&lt;BR /&gt;
"1"&lt;BR /&gt;
"a"&lt;BR /&gt;
"b"&lt;BR /&gt;
"1003"&lt;BR /&gt;
"1"&lt;BR /&gt;
"a"&lt;BR /&gt;
"b"&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Using the following code to import the file results in a file where StudyNumber is imported as a datetime field:&lt;BR /&gt;
&lt;BR /&gt;
proc import datafile="c:\testdata.txt"&lt;BR /&gt;
     dbms=dlm out=work.test&lt;BR /&gt;
  replace;&lt;BR /&gt;
  delimiter='09'x;&lt;BR /&gt;
  getnames=yes;&lt;BR /&gt;
  guessingrows=32767;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Interestingly, if one changes the first data record to have a StudyNumber of "301001" the file imports correctly.&lt;BR /&gt;
&lt;BR /&gt;
Since the OP needs to import 100s of files, he doesn't want to replace proc import with datastep code.&lt;BR /&gt;
&lt;BR /&gt;
Anyone have a clue as to why proc import is functioning that way and any direct way to change its behavior?&lt;BR /&gt;
&lt;BR /&gt;
Art&lt;BR /&gt;
&lt;BR /&gt;
p.s. I'm looking forward to finally meeting some of you in Vegas next week, especially at the combined SAS-L / SAS Discussion Forums / sasCommunity.org meetup.</description>
      <pubDate>Fri, 01 Apr 2011 18:05:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Import-Peculiarity/m-p/42576#M11077</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-04-01T18:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Import Peculiarity</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Import-Peculiarity/m-p/42577#M11078</link>
      <description>Hi.Art.T&lt;BR /&gt;
After check documentation.I found this:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc import out=invoice file="c:\demo.xlsb" dbms=excel replace;&lt;BR /&gt;
 &lt;B&gt; usedate=no;scantime=no;&lt;/B&gt;run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Tue, 05 Apr 2011 05:39:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Import-Peculiarity/m-p/42577#M11078</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-04-05T05:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Import Peculiarity</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Import-Peculiarity/m-p/42578#M11079</link>
      <description>Ksharp,&lt;BR /&gt;
&lt;BR /&gt;
Yes, if it were an Excel file, but it is a tab delimited file.&lt;BR /&gt;
&lt;BR /&gt;
Art</description>
      <pubDate>Wed, 06 Apr 2011 23:54:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Import-Peculiarity/m-p/42578#M11079</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-04-06T23:54:36Z</dc:date>
    </item>
  </channel>
</rss>

