BookmarkSubscribeRSS Feed
sasprogramming
Quartz | Level 8

I have 10 different csv files that I am importing.

8 of them import perfectly however the other dont don't import, there are no apparent differences between the files.

 

Attached is the log:

NOTE: The infile DUMMY is:
Filename=\peter\testing\sales_Dec20,
RECFM=V,LRECL=32767,File Size (bytes)=1240186,
Last Modified=15 June 2021 04:26:00,
Create Time=26 August 2021 19:10:30

NOTE: 0 records were read from the infile DUMMY.
I have been trying to work this out for a long time, but I can't seem to find whats wrong?
 
When I open the files in excel they all look the same. Is there any way I can inspect the file or something like that? It is very strange that this is happening.
I imported all the files into R with ease, but for some reason SAS doesn't like these two files...
 
Any help would be appreciated, thanks.
 
 
6 REPLIES 6
Kurt_Bremser
Super User

Inspect the files with a suitable text editor (e.g. Notepad++). It may be that your files use LF only as a record terminator (UNIX style).

Good text editors (see above) can show you the line termination style and reveal hidden characters.

sasprogramming
Quartz | Level 8

I am in the process of looking into the the files. If my files do use LF only, how do I deal with this?

Kurt_Bremser
Super User

Since you need to adapt the TERMSTR option, this may need macro coding, and will prevent you from reading a bunch of files in one data step.

If you need to set this up for some kind of production use, insist that consistent file formats are used.

andreas_lds
Jade | Level 19

Hints:

  • Post the code you are using, and please use "insert sas code"
  • post the complete log using "insert code"
  • don't open csv-files in excel, as it almost always does some dark magic to hide the real content of the file, use a text-editor instead
Ksharp
Super User
Can you post one of them,? so we can test it and find out where is problem.
sasprogramming
Quartz | Level 8

I think I have just found the problem.

 

It is the free text field in my data that seems to be the problem, most cell entries are like this:

jennifer wants $10000

sales too low

over the limit

 

However there are a few entries that have an equals at the beginning, like so:

=jennifer wants $10000

=sales too low

 

When I went into the raw data and removed the equals sign, the data successfully loaded in.

I don't understand why this is tho. I discovered this fix by trial and error pretty much.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 6 replies
  • 2018 views
  • 2 likes
  • 4 in conversation