06-17-2014 05:25 AM
I am having issues importing a dataset into SAS.
I am currently using the University Edition (Operating System Red Hat 64 bit).
I am entering the following code:
/** FOR CSV Files uploaded from Windows **/
FILENAME CSV "/folders/myfolders/DRTB/tblMAIN_DRTB_DATABASE.csv" TERMSTR=CRLF;
/** Import the CSV file. **/
PROC IMPORT DATAFILE=CSV
/** Print the results. **/
PROC PRINT DATA=WORK.DRTB; RUN;
/** Unassign the file reference. **/
And the following error message keeps coming up:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
43 PROC IMPORT DATAFILE=CSV
NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to
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.03 seconds
cpu time 0.04 seconds
50 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
Please help. Thanks!
06-17-2014 10:47 AM
Look at your input CSV file with a text editor and see if you have blank lines for the first 5 or more lines (exports from Excel are notorious for extra lines and columns). If they are blank, delete them and things should work.
The warning about the SASUSER.Parms. etc may mean that you had a SAS session open and created another instance. The SASUSER library catalogs would be locked by the first one. This often happens depending on your settings if you click on the code file to run it while a SAS session is open. The default behavior is to open another instance of SAS for the code file.
07-16-2014 08:29 PM
Use this snippet, the other one doesn't work for me either
PROC IMPORT DATAFILE ='/folders/myfolders/spx.csv' OUT = mydata REPLACE;
PROC PRINT DATA = mydata;
TITLE 'My data';
07-16-2014 09:11 PM
If it is a CSV file then just write the Data step to read it yourself. You will get better results than what PROC IMPORT would do since it will have to guess what types of values are in each column.
If you do not know what is in the file then you can use a DATA _NULL_ to read it and look at it.
For example use the LIST statement and OBS=10 to list the first 10 lines.
data _null_ ;
infile "/folders/myfolders/DRTB/tblMAIN_DRTB_DATABASE.csv" dsd OBS=10 TERMSTR=CRLF;