BookmarkSubscribeRSS Feed
art297
Opal | Level 21
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.
2 REPLIES 2
Ksharp
Super User
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
art297
Opal | Level 21
Ksharp,

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

Art

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 563 views
  • 0 likes
  • 2 in conversation