Date: Tue, 22 Dec 2009 06:07:27 +0200
Reply-To: eric <ericen@SAS.CN>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: eric <ericen@SAS.CN>
Organization: A noiseless patient Spider
Subject: Re: how to auto-resume where program last left off?
Content-Type: text/plain; format=flowed; charset="Windows-1252";
reply-type=original
am doing something wrong, tried this solution but did not get the format quite right.
assume filenames in e:\temp\found.txt are like
e:\temp\2009 1002 1027 test.txt
e:\temp\2009 1002 1159 test.txt
e:\temp\2009 1019 2109 test.txt
e:\temp\2009 1029 0702 test.txt
/* input already processed filenames so avoid reprocessing */
data times ( keep = fmtname type start label );
length fname $35;
retain fmtname '$filesdone' type 'C';
infile "e:\temp\found.txt" truncover;
input @1 fname $char40. ;
label = put(_n_,4.);
start = fname;
run;
proc format cntlin=times;
run;
%let y=2009;
%let o=10;
%let d=1;
%let h=1;
%let m=0;
/* read all filenames and compare if already processed */
data _null_;file "e:\temp\found.txt" mod ;
y1=input(symget('y'), 4.);
o1=input(symget('o'), 2.);
d1=input(symget('d'), 2.);
h1=input(symget('h'), 2.);
m1=input(symget('m'), 2.);
do o=o1 to o1;
do d=d1 to 31;
do h=h1 to 23;
do m=m1 to 59;
f1 = 'e:\temp\'|| put(y1,4.)||
' '||put(o,z2.)||put(d,z2.)||' '||put(h,z2.)||put(m,z2.)||' test.txt';
if put(f1, $filesdone.) < 1 then do;
if fileexist(f1) then put f1 ;
end;
end;end;end;end;
run;
|