i want to import data from a csv file with data step and infile instruction. i have in the file a colon comment in whitch i can have caracters such as ->. and it seems like sas inteprete ligne containing this caracter like end of the file. So, in the file if i have 500 lines and the 10th line have this caractere, SAS import just 10 lines and end the execution without errors or warning.
someone can help me?
Thks
It is a little unclear what your issue is (an actual SAS log would help).
But it looks like your data step is stopping reading the file in the middle?
If so the most likely cause is the "DOS end of file" character. There is an INFILE option to treat that character as a normal character instead of an end of file indicator.
IGNOREDOSEOF
is used in the context of I/O operations on variable record format files. When this option is specified, any occurrence of ^Z is interpreted as character data and not as an end-of-file marker.
You need to provide us a sample csv or code to work with please. You can take a look at some examples here..
A colon does not cause any issues:
data _null_;
file "~/test.csv";
input line $80.;
put line;
datalines;
xxx
yyy
:
x:
:
:x
;
data check;
infile "~/test.csv" truncover;
input line $80.;
run;
You will see that all 6 lines are read.
Please post the complete log of your step into a box opened with this button:
It is a little unclear what your issue is (an actual SAS log would help).
But it looks like your data step is stopping reading the file in the middle?
If so the most likely cause is the "DOS end of file" character. There is an INFILE option to treat that character as a normal character instead of an end of file indicator.
IGNOREDOSEOF
is used in the context of I/O operations on variable record format files. When this option is specified, any occurrence of ^Z is interpreted as character data and not as an end-of-file marker.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.