Date: Fri, 26 Jan 2007 13:04:22 -0500
Reply-To: Ed Heaton <EdHeaton@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ed Heaton <EdHeaton@WESTAT.COM>
Subject: Re: Loading different records from same file to diff tables
In-Reply-To: <1169832814.093838.15840@q2g2000cwa.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"
Andrew;
Data
oh( keep= ... )
aitch( keep= ... )
dee( keep= ... )
;
Input @1 RecordType $1. @ ;
Select (RecordType) ;
When ('O') do ;
Input ... ;
Output oh ;
End ;
When ('H') do ;
Input ... ;
Output aitch ;
End ;
When ('D') do ;
Input ... ;
Output dee ;
End ;
Otherwise putLog 'ERROR: Invalid Record Type!' ;
End ;
Run ;
Ed
Edward Heaton, Senior Systems Analyst,
Westat (An Employee-Owned Research Corporation),
1600 Research Boulevard, RW-4541, Rockville, MD 20850-3195
Voice: (301) 610-4818 Fax: (301) 294-3879
mailto:EdHeaton@Westat.com http://www.Westat.com
-----Original Message-----
From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]
On Behalf Of Andreww
Sent: Friday, January 26, 2007 12:34 PM
To: sas-l@uga.edu
Subject: Loading different records from same file to diff tables
Hi - I have 4 type of rec in a file:
Data looks like this:
0*000008090*0011*05JAN07*NKPAC*
H*118395675************01051950*xxxx@co.uk*
D*118395675*MORE_MILES*FUEL**
D*118395675*MORE_MILES*COAL**
D*118395675*KIDS_UNDER_16*NO**
D*118395675*EMPLOYMENT
H.....
D.....
D....
D....
H....
etc
rec 1 is a FILE header rec - starts with 0 - several vars after
rec 2 is person header rec - starts with H - several vars after
rec 3-6 are person detail recs start with D - several vars after
There can be upto about 30 detail recs (they rep answers to
questionnaire)
When H occurs again a new persons data starts
Make sense???
What I need to do is split out File recs and person header and detail
recs into 3 tables.
I have a feeling it's something to do with input and @@ code.
Any one have any ideas??
Cheers
Andrew