Learning SAS? Welcome to the exclusive online community for all SAS learners.

PROC IMPORT Delimited Data

Reply
Occasional Contributor
Posts: 10

PROC IMPORT Delimited Data

 

I'm using the following code to import a delimited file - Anyone have suggestions?

 

Appreciate it, Andy

 

PROC IMPORT DATAFILE="/folders/myfolders/PropertyData_R.txt"
DBMS=DLM
OUT=tad_import
REPLACE;
DELIMITER='|';
GETNAMES=YES;
RUN;

Super User
Posts: 17,829

Re: PROC IMPORT Delimited Data

Post your log. In general I recommend using a datastep to import rather than Proc Import. 

 

Proc Import will post the data step code to the log. Copy that code and check the variable type/length for the variable SAS indicates it has issues with. 

Super User
Posts: 10,500

Re: PROC IMPORT Delimited Data

One cause for this is that one of the data fields has a | imbedded that is not intended as a delimiter, such as a user might enter in a list like: chicken|steak or 1|3. Which can sometimes throw off the column counts.

 

Or a variable type is set to numeric because the first few rows make a column  look like it should be numeric but further columns contain text.

 

Try adding the statement

GUESSINGROWS = 32767;

 

Occasional Contributor
Posts: 10

Re: PROC IMPORT Delimited Data

Hi, thank you very much.  I did add GUESSINGROWS = 32767; and it worked!

 

Prior to implementing this fix, the log error essentially said "Proc Import failed see log for details...."  No further details were provided in the log.

 

GUESSINGROWS = 32767 resolved this error.  Prior the error was truncating an address field that shouldn't have been truncated, thereby cutting off the end of the character field i.e., "suite number" before it imported into SAS Studio.  Adding this GUESSINGROWS corrected this issue.  

 

Not sure exactly how it works but it solved my problem.

 

Once again thank you!

Ask a Question
Discussion stats
  • 3 replies
  • 296 views
  • 0 likes
  • 3 in conversation