SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Trying to import this tab delimited file but having some trouble seeing the data

Reply
Occasional Contributor
Posts: 9

Trying to import this tab delimited file but having some trouble seeing the data

Here is the code that I am using.

 

ods graphics on;
options ls=80 ps=50 nodate pageno=1;
Data HBAT;

Infile '/home/tmaciver7840/my_content/hbat tabs.txt' DLM = '09'X TRUNCOVER;

Input ID X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19

X20 X21 X22 X23;

 

The output data just shows the columns and there is nothing in the results. I don't see the actual data (screenshots attached). Where am I going wrong here? Thanks


Screen Shot 2016-06-24 at 12.51.55 PM.pngScreen Shot 2016-06-24 at 12.51.24 PM.pngScreen Shot 2016-06-24 at 12.51.19 PM.pngScreen Shot 2016-06-24 at 12.51.05 PM.png
Occasional Contributor
Posts: 9

Re: Trying to import this tab delimited file but having some trouble seeing the data

I'm hearing I need a library set up? Is this true?
Super User
Posts: 10,466

Re: Trying to import this tab delimited file but having some trouble seeing the data

If you don't specify a library then the default would be to assign the data to the WORK library. The Work library contents are deleted when you close the session. So if you want the data available without re-reading the file then it is best to create a permanent library

 

You have errors but you do not show the part of the log that would show the actual text of the errors. The bit displayed in the first PNG is typical when you specify a delimiter or other options in the INFILE incorrectly. Note that the  second block of data starting with 71 (which indicates the position in the data line) has X23.1.2.0.1 etc. and then just continues to 141 (and I'm guessing there are further lines),

 

First that indicates that SAS attempted to read the values of X1 X2 etc for the numeric variables X1. You likely wanted to have the option FirstObs=2 on the INFILE statement to skip what is likely a header row in the input file.

There may also be an issue with the end of line character of the dataset being other than the program expects (or completely missing). You may need to use the TERMSTR= option on the Infile statement, Possibly TERMSTR=CR if the file originated on a Mac. If the original file was PC then TERMSTR=CRLF may be needed, TERMSTR=LF for Unix.

Super User
Super User
Posts: 6,498

Re: Trying to import this tab delimited file but having some trouble seeing the data

[ Edited ]

I always wonder why people post photographs of their log?  Isn't it easier to copy and paste the TEXT from the log rather than taking a picture of it and trying to figure out how to get this web site to accept the picture?

 

Anyway the first picture shows your error.

First you are trying the read the header row as data and second SAS is not seeing the end of line.  You aslo probably want to add the DSD option to make sure it handles missing values properly.

 

infile '/home/tmaciver7840/my_content/hbat tabs.txt'
  DSD DLM = '09'X TRUNCOVER 
  FIRSTOBS=2 TERMSTR=CR 
;

 

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