PROC IMPORT OUT=&outdata.
DATAFILE="C:\Users\Administrator\Desktop\&fn..log"
DBMS=CSV REPLACE;
GETNAMES=NO;
DATAROW=20;
RUN;
I try to readin a text file, and success with datarow=20. But fail with datarow=30.
SAS does not give out details.
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.02 seconds
cpu time 0.01 seconds
Any limit on DATAROW?!
Why do you use PROC IMPORT for a CSV file? Write the data step yourself, with the proper FIRSTOBS= option in the INFILE statement.
Why are you using the DATAROW option? That is saying you want to skip the first 19 (or 29) lines of the file instead of just the header line. Are you sure the file had more than 29 lines?
Here is code to recreate your problem. There are only 19 observations in SASHELP.CLASS so the CSV file will only have 20 lines in it. So asking PROC IMPORT to start reading from line 30 will cause an error because there is no line 30.
filename csv temp;
proc export data=sashelp.class file=csv replace dbms=csv;
run;
proc import file=csv out=want replace dbms=csv;
datarow=30;
run;
3124 proc import file=csv out=want replace dbms=csv; 3125 datarow=30; 3126 run; 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.02 seconds cpu time 0.01 seconds
The file has thousands of lines. It is created at real time, all columns are numbers with first 20s(not stable) lines with -nan(ind).
Why do you use PROC IMPORT for a CSV file? Write the data step yourself, with the proper FIRSTOBS= option in the INFILE statement.
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!
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.