Date: Fri, 7 Apr 2000 22:55:53 +0100
Reply-To: R P Bullock <{$news$}@rerun.demon.co.uk>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: R P Bullock <{$news$}@NOSPAM.DEMON.CO.UK>
Organization: ReRun Ltd
Subject: Re: problem inputting raw data
In article <047cc049.79443197@usw-ex0105-036.remarq.com>, T. Flannery
<flannery_tNOflSPAM@hotmail.com.invalid> writes
>I hate to bother everyone with such a novice question, but I'm
>losing big patches of hair over this. Can anyone correct my
>input statement to read the follow raw data excerpt?
>
>TIA
>
>Flannery
>
>data a;
>* infile cards missover truncover;
>input iadmtx ddmmyy10. clientid $ 12-21 @23 site $ client_i $ 25-
>32 pclient_ $ 34-42
> birth_da ddmmyy10. client $ 55-64 @66 d12a ddmmyy10.;
>cards;
>02/06/1996 600397 2 600397
>03/17/1997
<snip>
Flannery,
Your data didn't travel well, but assuming that it is regular, I used:
infile cards missover;
input iadmtx mmddyy10.
clientid $ 12-21
@23 site $char1.
client_i $ 25- 32
pclient_ $ 34-42
@44 birth_da mmddyy10.
client $ 55-64
@66 d12a mmddyy10.
;
cards;
The changes I made were:
. use of 'missover' on the infile statement avoids problems where
the length of a record is less than that required by the input
statement.
. your dates appear to be month/day/year hence I changed the date
format to mmddyy
. having read pclient_ the input buffer column pointer is at 43,
but birth_da starts in column 44. Added '@44'.
. the method used to read 'site' defaulted the site variable to a
length of 8, but the structure of the file suggests that it can only be
one byte hence I added the '$char1.' format.
As your data seems to be regular in a column sense, my preference would
be to adopt a common approach to reading all of the data items. For
example:
input @1 iadmtx mmddyy10.
@12 clientid $char10.
@23 site $char1.
@25 client_i $char8.
@34 pclient_ $char9.
@44 birth_da mmddyy10.
@55 client $char10.
@66 d12a mmddyy10.
;
There are many variations on this theme, but usually style helps
enormously when you cannot see the wood for the trees, as I suspect was
the case here.
Bob
--
R P Bullock