importing csv file in sas studio

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

importing csv file in sas studio

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.

Accepted Solutions
Solution
‎09-14-2016 09:24 PM
Super User
Posts: 19,057

Re: importing csv file in sas studio

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


All Replies
Regular Contributor
Posts: 169

Re: importing csv file in sas studio

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.

New Contributor
Posts: 4

Re: importing csv file in sas studio

There aren't any blank rows. 

Super User
Posts: 19,057

Re: importing csv file in sas studio

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;
New Contributor
Posts: 4

Re: importing csv file in sas studio

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.

Solution
‎09-14-2016 09:24 PM
Super User
Posts: 19,057

Re: importing csv file in sas studio

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...

 

 

New Contributor
Posts: 4

Re: importing csv file in sas studio

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

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 586 views
  • 1 like
  • 3 in conversation