BookmarkSubscribeRSS Feed
PhilipH
Quartz | Level 8

Hi SAS Experts,

 

we run the below code and it imports 223 rows on 3 different machines using EG 7.1. and 6.x all using Windows 7.

The probem is we got one machine using EG 7.1 that imports only 220 rows. We have no idea why this is. The same code, the same input file. Any clues?

 

data Importcont_Import;
infile datalines;
length fil2read $40;
input fil2read $;
infile dummy filevar=fil2read end=done DSD
        DLM=';';
do while(not done);
INPUT
	        A               : $CHAR40.
	        B               : $CHAR40.
	        C               : $CHAR20.
	        D               : $CHAR20.
	        E               : $CHAR150.
	        F               : $CHAR25.
	        G               : $CHAR25.
	        H               : $CHAR25.
	        I               : $CHAR25.
	        J              : $CHAR25.
	        K              : $CHAR25.
	        L              : $CHAR25. 
	        M              : $CHAR25.
	        N              : $CHAR25.
	        O              : $CHAR20.
	        P              : $CHAR25.
	        Q              : $CHAR20.
	        R              : $CHAR20.
	        S              : $CHAR25.
	        T              : $CHAR50.
	        U              : $CHAR20.
	        V              : $CHAR20.
	        W              : $CHAR20.
	        X              : $CHAR25.
	        Y              : $CHAR20.
	        Z              : $CHAR2000. ;
  output;
end;
datalines;
C:\temp\NW201634.csv
;

Many thanks!

5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

What a peculier way to import a file, what with the datalines bit, also peculier that you are reading in a Comma Seperated Variable file with a delimiter of a Semi-colon.  As for why it is not working, other than the two oddities above, could be any number of things.  Are all EG's installed on the same OS, is the file created by the same OS - Unix has different end of line characters as opposed to Windows for instance.  It could be SAS options, don't know which one would impact it.  Try running proc options on each a working machine and the non working machine.

PhilipH
Quartz | Level 8

Hello RW9,

Thanks for you hints. The columns are delimited with ; in the data.
There is more than one file that I import in the datalines bit but for now, we are testing with one.
Yes, EG is installed on Windows 7 machines. I used https://www.diffchecker.com and could not find a difference in the proc options; output.

What are you other ideas on "any number of things" ? 🙂

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, if the OS is the same, the files are the same, the import program is the same, and the options are all the same then it sounds like a ticket into SAS help to me as that shouldn't happen.  Only other thing I can think off, have you looked at the imported data on both machnes - i.e. identify which rows are not imported - could it be that there is no end of line, so its reading over the end of line?  Remember there are special characters to delimit lines amongst other things, so a text comparison might ignore those.  

Identify what is missing, then focus in on those rows, use a hex editor (free portable ones like HN_Hex_Editor) to look at those rows closely, is there any special characters.  If you could snip down the file to the bit that doesn't work, you could post that here so we could look. 

ballardw
Super User

Do you get anything in the log about "went to new line"?

Since you are not specifying an LRECL value it may be that the one machine has a default LRECL value smaller than the others.

Run Proc Options and examine the LRECL value.

PhilipH
Quartz | Level 8

Hi.

Thanks for the reply. I opened a ticket with SAS support.

Both machines have  LRECL=32767 .

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1197 views
  • 0 likes
  • 3 in conversation