BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ajulio4
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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.

View solution in original post

4 REPLIES 4
CarmineVerrell
SAS Employee

You need to provide us a sample csv or code to work with please. You can take a look at some examples here..

SAS Help Center: Reading Raw Data: Examples

Kurt_Bremser
Super User

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:

Bildschirmfoto 2020-04-07 um 08.32.59.jpg

Tom
Super User Tom
Super User

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.

ajulio4
Obsidian | Level 7
thks so much it works this option. i can now import all of my file lines

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 830 views
  • 1 like
  • 4 in conversation