Help using Base SAS procedures

SAS crash during proc import of csv file

Reply
Regular Learner
Posts: 1

SAS crash during proc import of csv file

SAS (9.4) crashes every time I try to import a csv file using routine code that works fine for other files. I receive a 'sas.exe has stopped working' (A problem caused the program to stop working correctly. Please close the program.).

 

I'm using:

 

PROC IMPORT

DATAFILE="filepath.csv"

out=main

dbms=csv

 replace;

GUESSINGROWS=30;

run;

 

Any suggestions are greatly appreciated!

 

 

 

Community Manager
Posts: 3,441

Re: SAS crash during proc import of csv file

Obviously, a crash should not happen so this is a defect...somewhere.  But to try and diagnose, check the Windows event log.  (Type "eventvwr" in your Windows command bar)

 

Navigate to Windows Logs->Application, and filter on Error.  Find the SAS.EXE entry that corresponds with your crash, and you might get some more details that can help with a SAS Tech Support ticket.

 

eventvwr.png

 

It might be worth opening your CSV file in an editor like Notepad++ to see if there are special characters that SAS is balking at.  Again, should not cause a crash...but if it's happening, I'm sure that you just want to get to the bottom of it.

Super User
Posts: 13,583

Re: SAS crash during proc import of csv file


@lgq6 wrote:

SAS (9.4) crashes every time I try to import a csv file using routine code that works fine for other files. I receive a 'sas.exe has stopped working' (A problem caused the program to stop working correctly. Please close the program.).

 

I'm using:

 

PROC IMPORT

DATAFILE="filepath.csv"

out=main

dbms=csv

 replace;

GUESSINGROWS=30;

run;

 

Any suggestions are greatly appreciated!

 

 

 


1) Run that import for one of the files that it works for.

2) copy the generated data step code from the log and paste into the editor (or use the F4 to recall last submitted code)

3) edit the data step INFILE statement to point to the problem file. If you copied from the log you may also have to remove line numbers at the start of each code line.

4) Save the program code

5) run the modified program

 

You may get some interesting errors.

 

In the future you may find that using an existing program to read a CSV file results in more consistent data, especially if compare the generated code against expected or defined variable behavior for the data interchange or source file descriptions.

 

My guess is the file is not actually CSV, possibly violating one or more conventions such as quotes around text with commas as part of the value.

Ask a Question
Discussion stats
  • 2 replies
  • 83 views
  • 1 like
  • 3 in conversation