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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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