output is right but there is error message in log file

Accepted Solution Solved
Reply
Occasional Contributor epr
Occasional Contributor
Posts: 14
Accepted Solution

output is right but there is error message in log file

Hello All

I am learning sas now . I am practicing some small projects posted online.

This is one clinical trials project.

rawdate

PatientDose Date
00101Jan2003
00102Jan2003
00215Mar2003
00201Mar2003
00301Apr2003
00419Mar2003

I created dataset using this code in sas

data dose;

infile 'C:\Users\Contacts\Desktop\dose.txt' dlm='09'x dsd  firstobs=2;

input id $ 3. +1 dosedate date9.;

format dosedate date9.;

I got right output.This is output

Obs id dosedate

1 001 01JAN2003

2 001 02JAN2003

3 002 15MAR2003

4 002 01MAR2003

5 003 01APR2003

6 004 19MAR2003

But i see error in log file

NOTE: LOST CARD.

id=  dosedate=. _ERROR_=1 _N_=7

NOTE: 8 records were read from the infile 'C:\Users\Contacts\Desktop\dose.txt'.

      The minimum record length was 0.

      The maximum record length was 13.

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

NOTE: The data set WORK.DOSE has 6 observations and 2 variables.

NOTE: DATA statement used (Total process time):

      real time           0.04 seconds

      cpu time            0.01 seconds

There are only six records in Rawdata. But sas reading 8 records .

I need some help to understand this logfile.

Thank you


Accepted Solutions
Solution
‎04-09-2013 09:22 AM
Super User
Super User
Posts: 7,050

Re: output is right but there is error message in log file

Try adding TRUNCOVER option to the INFILE statement to prevent SAS from trying to go to the next line if you read past the end of the line.

You do not need the +1 in the INPUT statement. If your data really has a tab ('09'x) between the id and the date then SAS will automatically start reading the value for the date after the tab.

View solution in original post


All Replies
Solution
‎04-09-2013 09:22 AM
Super User
Super User
Posts: 7,050

Re: output is right but there is error message in log file

Try adding TRUNCOVER option to the INFILE statement to prevent SAS from trying to go to the next line if you read past the end of the line.

You do not need the +1 in the INPUT statement. If your data really has a tab ('09'x) between the id and the date then SAS will automatically start reading the value for the date after the tab.

Occasional Contributor epr
Occasional Contributor
Posts: 14

Re: output is right but there is error message in log file

Now idon't see any error , dlm is tab but with out +1 i am getting this output

Obs id dosedate

1   001   .

2   002   .

3   002   .

4   002   .

5   003   .

6   004   .

Super User
Super User
Posts: 7,050

Re: output is right but there is error message in log file

Most likely you have a space after the tab and before the date value.

Try using : modifier in front of the date format.  I worry that if your data is inconsistent about whether the extra character is there you might skip over the first actual digit of the date value using the +1 cursor movement command.  See example below using | in place of tabs.

data test;

  infile cards dlm='|' truncover ;

  input id 3. date :date9. ;

  format date date9.;

  put (id date) (=);

cards;

001|11jan2012

002| 11jan2012

003 21jan2012

run;

Respected Advisor
Posts: 3,799

Re: output is right but there is error message in log file

You need colon or informat statement

input id :$3. dosedate :date9.;

🔒 This topic is solved and locked.

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

Discussion stats
  • 4 replies
  • 228 views
  • 3 likes
  • 3 in conversation