|
Awesome cool--thanks! This set me up perfectly to do the
multiple-file-format-versioning stuff I needed next:
filename oic 'N:\oncology_infusion_center\IP401B-*.txt' ;
data s.drop_me ;
retain version 1 ;
infile oic eov = new_file ;
input @ ;
if _n_ = 1 or new_file then do ;
* If this file has account number, its a version 2. ;
if index(lowcase(_infile_), 'acct') > 0 then version = 2 ;
else version = 1 ;
new_file = 0 ;
delete ;
end ;
select (version) ;
when (1) do ;
input
@1 consumno $char8.
@12 attending_provider $char30.
@43 service_date date11.
@55 cpt4_description $char40.
@96 cpt4 $char6.
@103 qty $char5.
@109 price nlmny11.2
;
end ;
when (2) do ;
input
@1 consumno $char8.
@12 acct $char9.
@22 attending_provider $char30.
@53 service_date date11.
@65 cpt4_description $char40.
@106 cpt4 $char6.
@113 qty $char5.
@119 price nlmny11.2
@131 icd9 $char6.
@138 idc9_description $char50.
;
end ;
otherwise do ;
put "ERROR: Unexpected value of version!!!" ;
end ;
end ;
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
data _null_;
Sent: Wednesday, August 08, 2007 9:57 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Multi-file INFILE statement only honors FIRSTOBS option for
first file processed?
INFILE option EOV is used to detect the presence of a "new" file when
reading concatenated files with wild card infile.
filename in '.\*.log';
data work.test;
infile in eov=eov length=l;
if _n_ eq 1 or eov eq 1 then do;
input;
eov = 0;
delete;
end;
else do;
input line $varying200. l;
output;
end;
run;
|