Solved
New Contributor
Posts: 4

# Informat acting funny!!

Hey guys,

I was training a few of my interns and we were working on infile using cards. I landed up at the code below and it surprisingly is working fine against all logic. Can anyone help me solve this mystery? Despite the fact that I have specified Date7. in my informat, I'm able to read the dates right, which are in date9..

data test;
informat DepartureDate date7. ;
length country \$11.;
format DepartureDate date9. ;
input Country \$ DepartureDate blah \$;
cards;
Japan 13may2000 a
New_Zealand 03feb2001 b
Brazil 28feb2001 c
Italy 25apr2001 z
USSR 03jun1997 q
Switzerland 14jan2001 a
Ireland 27aug2000 r
;
run;

proc print;
run;

Regards,
Varun

Accepted Solutions
Solution
‎01-15-2013 09:56 AM
Super User
Posts: 8,120

## Re: Informat acting funny!!

Looks like it is working because you are using list mode input.  So it is smart enough to see that the full token of text is 9 characters and uses them all.

Compare with these two INPUT statements.

input Country \$ DepartureDate date7. blah \$;

input Country \$ DepartureDate :date7. blah \$;

All Replies
Posts: 3,852

## Re: Informat acting funny!!

I think the length is ignored when using LIST input.  List input reads until it finds blank.  Now let me see if I can find where that is documentated.

Solution
‎01-15-2013 09:56 AM
Super User
Posts: 8,120

## Re: Informat acting funny!!

Looks like it is working because you are using list mode input.  So it is smart enough to see that the full token of text is 9 characters and uses them all.

Compare with these two INPUT statements.

input Country \$ DepartureDate date7. blah \$;

input Country \$ DepartureDate :date7. blah \$;

🔒 This topic is solved and locked.