first method: SAS
I open the .doc file and save it as .html file then do the following code:
filename in "C:\temp\sample.htm";
data sashelp.testsample;
infile in pad missover lrecl=300;
input source $200.;
run;
data need;
set sashelp.testsample;
year=year(date());
call symput('applyYear',strip(year-1));
run;
data need;
set need;
if index(source,"June 12, 2006") then do;
source=tranwrd(source,'2006',year);
end;
run;
filename out "C:\temp\samplenew.doc";
data _null_;
file out;
set need;
put source ;
run; The new .doc file is I need, change the view from web view to print view when open it in MS word.
Second method: VBA:
see attachment sampleVBA
the two arrows will change the year between 2006 and 2016.
the VBA is very simple .need add more feature to make the function better.
for example if I want change the year to current year ......
Thanks!
... View more