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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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