DATA Step, Macro, Functions and more

Infile command record count issue

Accepted Solution Solved
Reply
Contributor
Posts: 35
Accepted Solution

Infile command record count issue

records.dat have 5000 records, but my main_set dataset have only 4999 records.
Not able to figure out what is wrong with this. any pointers would be of great help!

 

Data main_set;
infile "records.dat" dlm='|' dsd truncover;
input id : $10.
name : $25.
;
run;


Accepted Solutions
Solution
‎04-20-2017 07:30 AM
Super User
Posts: 7,768

Re: Infile command record count issue

In which way have you determined that records.dat actually contains 5000 lines?

If on UNIX, do a

wc -l records.dat

to verify this.

And check that you don't have a stray obs= system option set to 4999 (been there, done that).

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Trusted Advisor
Posts: 1,137

Re: Infile command record count issue

could you try using the firstobs=1, also are you getting the first row with variable names into the dataset.

Data main_set;
infile "records.dat" dlm='|' dsd truncover firstobs=1;
input id : $10.
name : $25.
;
run;
Thanks,
Jag
Solution
‎04-20-2017 07:30 AM
Super User
Posts: 7,768

Re: Infile command record count issue

In which way have you determined that records.dat actually contains 5000 lines?

If on UNIX, do a

wc -l records.dat

to verify this.

And check that you don't have a stray obs= system option set to 4999 (been there, done that).

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 35

Re: Infile command record count issue

Posted in reply to KurtBremser

Thanks Kurt. Yup Obs was the villian Smiley Happy

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 119 views
  • 0 likes
  • 3 in conversation