Help using Base SAS procedures

Proc Import Peculiarity

Reply
PROC Star
Posts: 7,363

Proc Import Peculiarity

Someone asked this on SAS-L this morning and I'm wondering if my discussion forum colleagues might have an answer.

Suppose you had/created the following tab delimited file:

filename testdata "c:\testdata.txt";
data _null_;
file testdata;
length thedata $15;
input thedata;
put thedata @;
if mod(_n_,4) eq 0 then put;
else put "09"x @;
cards;
StudyNumber
vara
varb
varc
"1001"
"1"
"a"
"b"
"1002"
"1"
"a"
"b"
"1003"
"1"
"a"
"b"
;
run;

Using the following code to import the file results in a file where StudyNumber is imported as a datetime field:

proc import datafile="c:\testdata.txt"
dbms=dlm out=work.test
replace;
delimiter='09'x;
getnames=yes;
guessingrows=32767;
run;

Interestingly, if one changes the first data record to have a StudyNumber of "301001" the file imports correctly.

Since the OP needs to import 100s of files, he doesn't want to replace proc import with datastep code.

Anyone have a clue as to why proc import is functioning that way and any direct way to change its behavior?

Art

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.
Super User
Posts: 9,681

Re: Proc Import Peculiarity

Hi.Art.T
After check documentation.I found this:

[pre]
proc import out=invoice file="c:\demo.xlsb" dbms=excel replace;
usedate=no;scantime=no;run;
[/pre]



Ksharp
PROC Star
Posts: 7,363

Re: Proc Import Peculiarity

Ksharp,

Yes, if it were an Excel file, but it is a tab delimited file.

Art
Ask a Question
Discussion stats
  • 2 replies
  • 89 views
  • 0 likes
  • 2 in conversation