SAS went to a new line when INPUT statement reached past the end of a line.

Reply
Occasional Contributor NOA
Occasional Contributor
Posts: 8

SAS went to a new line when INPUT statement reached past the end of a line.

Trying out some "how to trouble shoot" SAS issues as suggested by a mentor. I want to reiterate that I am very new at SAS ( a real novice) and so I am trying to understand the concepts better.

I tried running this (this is a shortened version because the original one actually has 600000 observations) but I ended up getting this warning

NOTE: LOST CARD
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.

NOTE: The data set WORK.NEWBIE has 500000 observations and 8 variables ---> Its suppose to be 600,000

xt t

DATA NEWBIE;

INPUT YEAR CODE1 CODE2 DOB MARRIED $ DATE yyddmm10. NUMBER1 NUMBER2;

2010 2010000008 NULL 1984 N 2009-05-23    15 40

2010 2010000067 2013128497 1979 Y 2009-06-30    07 37

2010 2010000044 NULL 1980 Y 2009-05-19    13 40

2010 2010000009 NULL 1984 Y 2009-06-04    13 40

2010 2010000029 NULL 1975 N 2009-07-23    10 39

2010 2010000040 NULL 1981 Y 2009-05-01    12 40

2010 2010000091 NULL 1974 Y NULL 99 35

2010 2010000082 NULL 1987 Y 2009-04-27    12 38

2010 2010000003 NULL 1989 Y 2009-09-07    12 36

2010 2010000057 NULL 2001 N NULL 12 37

2010 2010000008 NULL 2013 N NULL 13 38

2010 2010000059 NULL 2015 N 2009-07-03    12 39

;

RUN;

I searched online and some mentioned adding a truncover statement next to infile. As you can see, in this one I have no INFILE statement at all.

Help would be much appreciated as to how I can run this.

Thank you.

PROC Star
Posts: 7,363

Re: SAS went to a new line when INPUT statement reached past the end of a line.

Your problem isn't the fact that you don't have the truncover option in place.  I show how to include it, below, but it isn't actually necessary.

First, there is no cards or datalines statement in your code thus, since it ran, I presume you simply forgot to show it in the code that you posted.

I presume you ended up with an extremely long log as the string NULL would cause a warning each time it was confronted.

The main problem you have is that some of your datalines have number1 too close to the date field.

Try the following, look at the code to see what is different from your code, and do a Google search for anything that you don't understand:

DATA NEWBIE;

  infile cards truncover;

  input @;

  _infile_=tranwrd(_infile_,'NULL',.);

  INPUT YEAR CODE1 CODE2 DOB MARRIED $ DATE: yymmdd10. NUMBER1 NUMBER2;

  cards;

2010 2010000008 NULL 1984 N 2009-05-23    15 40

2010 2010000067 2013128497 1979 Y 2009-06-30    07 37

2010 2010000044 NULL 1980 Y 2009-05-19    13 40

2010 2010000009 NULL 1984 Y 2009-06-04    13 40

2010 2010000029 NULL 1975 N 2009-07-23    10 39

2010 2010000040 NULL 1981 Y 2009-05-01    12 40

2010 2010000091 NULL 1974 Y NULL 99 35

2010 2010000082 NULL 1987 Y 2009-04-27    12 38

2010 2010000003 NULL 1989 Y 2009-09-07    12 36

2010 2010000057 NULL 2001 N NULL 12 37

2010 2010000008 NULL 2013 N NULL 13 38

2010 2010000059 NULL 2015 N 2009-07-03    12 39

;

RUN;

Occasional Contributor NOA
Occasional Contributor
Posts: 8

Re: SAS went to a new line when INPUT statement reached past the end of a line.

It worked!

Thank you very, very much. I do want to ask though, what is the difference between datalines and card?

Super User
Posts: 6,938

Re: SAS went to a new line when INPUT statement reached past the end of a line.

Simply put: none.

One is just an alias for the other.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
PROC Star
Posts: 7,363

Re: SAS went to a new line when INPUT statement reached past the end of a line.

Aside from spelling and number of characters there is at least one more difference which you can read about in the following thread:

Ask a Question
Discussion stats
  • 4 replies
  • 1678 views
  • 1 like
  • 3 in conversation