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.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.