Hello all;
There is a very large external flat file named external, I want to use it in hash join.how to use infile statement to do it?
Here is test code:
data external; /*I don't want to create this data set here,the data is too large,I want use infile in hash join step directly*/
infile cards;
input ptnum $ 1-3 @5 date date9. event $ 15-35;
format date date9.;
cards;
ABC 16NOV2009 Nausea
DEF 16NOV2009 Heartburn
DEF 16NOV2009 Acid Indigestion
DEF 18NOV2009 Nausea
GHI 17NOV2009 Fever
GHI 18NOV2009 Fever
MNO 17NOV2009 Fever
;
run;
data cm;
infile cards;
input ptnum $ 1-3 @5 date date9. medication $ 15-35;
format date date9.;
cards;
ABC 16NOV2009 Dopamine
DEF 16NOV2009 Antacid
DEF 16NOV2009 Sodium bicarbonate
aaa 18NOV2009 Dopamine
bbb 18NOV2009 Asprin
ccc 19NOV2009 Asprin
ddd 17NOV2009 Asprin
;
run;
Data ae_rspndt;
If _n_ = 1 then do;
if 0 then set cm ;
declare hash cm(dataset: "work.cm") ;
rc=cm.defineKey("ptnum", 'date');
rc=cm.defineData(ALL: 'YES');
rc=cm.defineDone() ;
end;
do until (eof);
set external end=eof;/*In this step, I want to change set external to infile statement*/
rc = cm.find();
if rc = 0 then do;
output ;
end;
end;
stop;
Run;
I want change "set external" to directly use infile statement like:
Data ae_rspndt2;
If _n_ = 1 then do;
if 0 then set cm ;
*declare hash cm(dataset: "work.cm",hashexp:16,multidata:"Yes") ;
declare hash cm(dataset: "work.cm") ;
rc=cm.defineKey("ptnum", 'date');
rc=cm.defineData(ALL: 'YES');
rc=cm.defineDone() ;
end;
do until (eof);
infile "An--external--file" end=eof;
input ptnum $ 1-3 @5 date date9. event $ 15-35;
rc = cm.find();
if rc = 0 then do;
output ;
end;
end;
stop;
Run;
But itnot works, please help.
Thanks!
... View more