BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
marissamac
Fluorite | Level 6
I'm trying to import a .csv file into SAS Studio and keep receiving this error. 
 
 
56 /* Generated Code (IMPORT) */
57 /* Source File: LOWBWT.csv */
58 /* Source Path: /folders/myfolders/sasuser.v94 */
59 /* Code generated on: 9/14/16, 3:05 PM */
60
61 %web_drop_table(WEBWORK.IMPORT);
62
63
64 FILENAME REFFILE '/folders/myfolders/sasuser.v94/LOWBWT.csv';
65
66 PROC IMPORT DATAFILE=REFFILE
67 DBMS=CSV
68 OUT=WEBWORK.IMPORT;
69 GETNAMES=YES;
70 RUN;
 
NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to
WORK.PARMS.PARMS.SLIST.
Unable to sample external file, no data in first 5 records.
ERROR: Import unsuccessful. See SAS Log for details.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.06 seconds
cpu time 0.05 seconds
 
71
 
 
72 PROC CONTENTS DATA=WEBWORK.IMPORT; RUN;
ERROR: File WEBWORK.IMPORT.DATA does not exist.
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

This error seems to occur when the file is in a format not expected by SAS, specifically, the TERMSTR (end of line) character is not what's expected.

 

Take a look at the TERMSTR options that you can add to your filename/file statement to import the file correctly:

options are (CRLF/LF/CR). You can examine your file in a text editor to see which end of line character is being used.

 

http://support.sas.com/documentation/cdl/en/hostunx/63053/HTML/default/viewer.htm#p0upngkius4n84n17w...

 

 

View solution in original post

6 REPLIES 6
paulkaefer
Lapis Lazuli | Level 10

See in the log output: Unable to sample external file, no data in first 5 records.

 

What does your file look like? Are there a few blank rows? If so, try the DATAROW= option.

marissamac
Fluorite | Level 6

There aren't any blank rows. 

Reeza
Super User

Usually that means somethings wrong with your file.

What type of error do you get if you directly reference the file?

Also, the path is case sensitive, so if it's lowbwt that's different than LOWBWT.

 

 

 PROC IMPORT DATAFILE='/folders/myfolders/sasuser.v94/LOWBWT.csv'
 DBMS=CSV
 OUT=WEBWORK.IMPORT;
 GETNAMES=YES;
 RUN;
marissamac
Fluorite | Level 6

THe file is Named LOWBWT, so that's probably nto the issue in naming. Aslo, with a direct reference I'm getting the same exact error.

Reeza
Super User

This error seems to occur when the file is in a format not expected by SAS, specifically, the TERMSTR (end of line) character is not what's expected.

 

Take a look at the TERMSTR options that you can add to your filename/file statement to import the file correctly:

options are (CRLF/LF/CR). You can examine your file in a text editor to see which end of line character is being used.

 

http://support.sas.com/documentation/cdl/en/hostunx/63053/HTML/default/viewer.htm#p0upngkius4n84n17w...

 

 

marissamac
Fluorite | Level 6

I'm using a mac, so I had to add termstr=cr. Thank you for your help!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 4986 views
  • 2 likes
  • 3 in conversation