BookmarkSubscribeRSS Feed
Ajayvit
Obsidian | Level 7

Dear,

While executing below dataset I am getting error.

Can some one help to figure out why is the error and how to correct it.

 

Data testing3;
infile datalines dlm=',';
input pid name$ ad date9. dc date9. ;
format ad dc date9.;
datalines;
101,Thanaos,12Jan2019,29Jan2019
201,Dtrange,11Mar2019,18Mar2019
301,Steve,23Sep2018,19Feb2019
401,Steve,23Sep2018,01May2019
;
run;

 

Error:

Data testing3;
308 infile datalines dlm=',';
309 input pid name$ ad date9. dc date9. ;
310 format ad dc date9.;
311 datalines;

NOTE: Invalid data for dc in line 312 21-29.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----
312 101,Thanao,12Jan2019,29Jan2019
pid=101 name=Thanao ad=12JAN2019 dc=. _ERROR_=1 _N_=1
NOTE: Invalid data for dc in line 313 22-30.
313 201,Dtrange,11Mar2019,18Mar2019
pid=201 name=Dtrange ad=11MAR2019 dc=. _ERROR_=1 _N_=2
NOTE: Invalid data for dc in line 314 20-28.
314 301,Steve,23Sep2018,19Feb2019
pid=301 name=Steve ad=23SEP2018 dc=. _ERROR_=1 _N_=3
NOTE: Invalid data for dc in line 315 20-28.
315 401,Steve,23Sep2018,01May2019
pid=401 name=Steve ad=23SEP2018 dc=. _ERROR_=1 _N_=4
NOTE: The data set WORK.TESTING3 has 4 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds


316 ;
317 run;

1 REPLY 1
data_null__
Jade | Level 19

When using LIST input with and explicit INFORMAT you need to add the colon format modifier.

 

Data testing3;
infile datalines dlm=',';
input pid name $ (ad dc)(:date.);
format ad dc date9.;
datalines;
101,Thanaos,12Jan2019,29Jan2019
201,Dtrange,11Mar2019,18Mar2019
301,Steve,23Sep2018,19Feb2019
401,Steve,23Sep2018,01May2019
;
run;
proc print;
   run;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 4412 views
  • 0 likes
  • 2 in conversation