/*Text changer by Kaz Uekawa www.estat.us Imagine you have fifty organizations to report to. You prepared the report and before you send your report you realize you spotted an error. Imagine instead of saying "2003" you needed to say "2005." You don't want to open fifty documents to make this change. This SAS syntax lets you run a MS-word macro like below, so you can replace every occurance of, say, 2003 with 2005. You can create this tyep of MS-word macro by recording it in MS-word. Sub TextChange() Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "2003" .Replacement.Text = "2005" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .CorrectHangulEndings = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = False .MatchFuzzy = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub */ options noxwait noxsync; %let folder=c:\temp; %macro john (name=); filename cmds dde 'WinWord|System'; data _null_; file cmds; put '[FileOpen .Name = "' "&folder\&name" '"]'; run; filename cmds dde 'WinWord|System'; data _null_; file cmds; put '[TextChange()]';/*TextChange is the name of a macro you write in MS-WORD*/ put '[fileSave()]'; Put '[fileclose()]'; stop; run; %mend john; %john (name=central hospital.doc ); %john (name=west hospital.doc );