Find below some sample code that gets you close to what you want. You have to decide how you want to handle the empty lines and which character(s) to but between the text that goes over several lines.
filename mydata temp;
data _null_;
infile cards truncover;
input line $256.;
putlog line=;
file mydata;
put line;
cards4;
Scheme ID: 3111
Product:
MUREX INR/USD FX Futures (IU)
Incentive:
The Participant shall receive a cash incentive of US$0.50 per lot traded electronically. The total cash incentive payment shall be capped at US$10,000 per month.
Scheme ID: 3115
Product:
MUREX INR/USD FX Futures (IU)
Incentive:
Cash incentive of US$0.50 per lot of IU traded, subject to the Participant fulfilling the market making obligations and conditions specified below. The total cash incentive payment shall be capped at US$5,000 per month.
Conditions:
Beautiful pebbles of varied sizes, suitable to decorate fish tank, small fountain, patio decoration:
i) Spot Month outright
Comes in different colours, white, and black. Very seldom used
ii) Your safety is important to us and we believe that you can stay safe.
Self collect near buangkok MRT station.
;;;;
data want;
infile myData truncover end=last;
length
schemeID $ 16
product $ 40
incentive $ 1024
conditions $ 1024
;
retain
schemeID
product
incentive
conditions
flag_incentive
flag_conditions
;
input
line $256.
;
if line =: "Scheme ID:" then do;
if _n_ > 1 then do;
output;
call missing(product, incentive, conditions);
call missing(flag_incentive, flag_conditions);
end;
schemeID = scan(line, -1, " ");
end;
if line =: "Product:" then do;
input product $64.;
end;
if line =: "Incentive:" then do;
call missing(flag_incentive, flag_conditions);
flag_incentive = 1;
return;
end;
if line =: "Conditions:" then do;
call missing(flag_incentive, flag_conditions);
flag_conditions = 1;
return;
end;
if flag_incentive = 1 then do;
incentive = catx("<BR>", incentive, line);
end;
if flag_conditions = 1 then do;
conditions = catx("<BR>", conditions, line);
end;
if last = 1 then do;
output;
end;
drop line;
run;
filename mydata clear;
proc print data=want;
run;
Bruno
... View more