|
Jeomoan,
I believe what you are looking for is the / in your input statement.
Check out this code.
data cd ;
*infile incd firstobs=1 lrecl=75 ; /* commented out since using cards
instead of input file*/
input
@1iden $6. @;
if iden =: '1000' then do ;
input x $ 1-6 y $ 8-10 z $ 11-13 xx $ 14-16 yy $ 17-20 zz $ 21-23 /
bd $ 1-2 be $ 4-5 bf $ 7-8 bg $ 10-11 bh $ 13-14 bi $ 16-17 bj $ 19-
20 /
cd $ 1-2 ce $ 4-5 cf $ 7-8 cg $ 10-11 ch $ 13-14 ci $ 16-17 cj $ 19-
20 ;
end ;
else delete;
cards;
test test test test test
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
;
run;
Greg M. Woolridge
Manager, Study Programming
TAP Pharmaceutical Products Inc.
e-mail: greg.woolridge@tap.com
phone: 847-582-2332
fax: 847-582-2403
Jeomoan Kurian
<jeomoan@GMAIL.CO To: SAS-L@LISTSERV.UGA.EDU
M> cc:
Sent by: "SAS(r) Subject: reading the a textfile to sas from multiline text file
Discussion"
<SAS-L@LISTSERV.U
GA.EDU>
07/15/2004 03:48
PM
Please respond to
Jeomoan Kurian
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
|