DATA Step, Macro, Functions and more

Input antics - reading date fields with column input.

Accepted Solution Solved
Reply
Respected Advisor
Posts: 4,920
Accepted Solution

Input antics - reading date fields with column input.

I have a question about something I must have forgotten...

Why does test1 fail, but not test2 or test3?

data test1;
informat d date9.;
input d 1-9;
datalines;
01JAN1999
;

data test2;
length dTxt $9;
input dTxt 1-9;
d = input (dTxt, date9.);
datalines;
01JAN1999
;

data test3;
input d :date9.;
datalines;
01JAN1999
;

PG

PG

Accepted Solutions
Solution
‎02-17-2012 01:21 PM
PROC Star
Posts: 7,472

Input antics - reading date fields with column input.

According to the documentation:

Note:   You cannot use an informat with column input.


View solution in original post


All Replies
Solution
‎02-17-2012 01:21 PM
PROC Star
Posts: 7,472

Input antics - reading date fields with column input.

According to the documentation:

Note:   You cannot use an informat with column input.


Respected Advisor
Posts: 4,920

Input antics - reading date fields with column input.

That settles that! Thanks.

PG

PG
Super User
Super User
Posts: 7,043

Input antics - reading date fields with column input.

Use @.

data test1b;

informat d date9.;

format d date9.;

input @1 d ;

put d=;

datalines;

01JAN1999

;

data test1c;

format d date9.;

input @1 d date9.;

put d=;

datalines;

01JAN1999

;

🔒 This topic is solved and locked.

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

Discussion stats
  • 3 replies
  • 178 views
  • 3 likes
  • 3 in conversation