Date: Thu, 15 Jul 2004 23:25:20 -0400
Reply-To: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject: Re: reading the a textfile to sas from multiline text file
Try the PAD option or the TRUNCOVER option in the INFILE statement.
On Thu, 15 Jul 2004 16:48:05 -0400, Jeomoan Kurian <jeomoan@GMAIL.COM>
wrote:
>Sas-l,
>
>I am reading a text file into sas where a record in SAS is read from
>multiple text lines . Also,the data is read based on a condition where
>the program should start reading from a point where the criteria are
>met and then go on to the next several lines until all variables are
>read. I used the below program but i believe the multi lines are
>giving me some trouble. I have 7 blank spaces end of every line ..
>
>Thanks in advance
>-Jeo
>
>
>
>data cd ;
>infile incd firstobs=1 lrecl=75 ; /* this includes balnk spaces in each
line*/
>input
>@1iden $6. @;
>if iden =: '1000' then do ;
>input x $ 1-6 y $ 7-8 ........bd $ 27-28 ;/* BD is reading from next
line*/
>end ;
>else delete;
>run;
>
>sample data:
>------------------
>test test test test test /* there are 7 blank spaces after
>every line*/
>100034 AB BC CC 100 A20
>A2 B2 C2 D2 H2 K2 L2
>A3 B3 C3 D3 H3 K3 L3
>test test test test test
>100035 AD BD CD 100 A20
>A2 B2 C2 D2 H2 K2 L2
>A3 B3 C3 D3 H3 K3 L3
>
>--
>Jeomoan Kurian
>Six Corporate Dr. Shelton, CT-06484-0861
|