BookmarkSubscribeRSS Feed
NOA
Calcite | Level 5 NOA
Calcite | Level 5

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.

4 REPLIES 4
art297
Opal | Level 21

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;

NOA
Calcite | Level 5 NOA
Calcite | Level 5

It worked!

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

art297
Opal | Level 21

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 9526 views
  • 2 likes
  • 3 in conversation