BookmarkSubscribeRSS Feed
BrahmanandaRao
Lapis Lazuli | Level 10

data dsn;
input id 1-3 visit_date 4-12 ;
informat visit_date date 10.;
format visit_date date 11.;
datalines;
001 05-may-2019
002 05-jun-2019
003 05-jul-2019
004 05-aug-2019
005 05-sep-2019
;
run;

 

 

I got error  like below

NOTE: Variable date is uninitialized.
NOTE: Invalid data for visit_date in line 144 4-12.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----
144 001 05-may-2019
id=1 visit_date=. date=. _ERROR_=1 _N_=1
NOTE: Invalid data for visit_date in line 145 4-12.
145 002 05-jun-2019
id=2 visit_date=. date=. _ERROR_=1 _N_=2
NOTE: Invalid data for visit_date in line 146 4-12.
146 003 05-jul-2019
id=3 visit_date=. date=. _ERROR_=1 _N_=3
NOTE: Invalid data for visit_date in line 147 4-12.
147 004 05-aug-2019
id=4 visit_date=. date=. _ERROR_=1 _N_=4
NOTE: Invalid data for visit_date in line 148 4-12.
148 005 05-sep-2019
id=5 visit_date=. date=. _ERROR_=1 _N_=5
NOTE: The data set WORK.DSN has 5 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds


149 ;
150 run;

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Is there a reason you want to use column pointers? Why not simply:

 

data dsn;
input id visit_date :date11.;
format visit_date date11.;
datalines;
001 05-may-2019
002 05-jun-2019
003 05-jul-2019
004 05-aug-2019
005 05-sep-2019
;
run;    

 

Astounding
PROC Star
Format and informat names must be one word, not two. Remove the extra blank:

format visit_date date11.;
Informat visit_date date11.;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 360 views
  • 2 likes
  • 3 in conversation