Date: Tue, 17 Jul 2007 23:31:12 -0700
Reply-To: medpower@GMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: medpower@GMAIL.COM
Organization: http://groups.google.com
Subject: Re: RTF File Size
In-Reply-To: <NIECJIJPHOLPKIFCPLHOAEFFJNAA.d@dkvj.biz>
Content-Type: text/plain; charset="us-ascii"
Martin,
I also encountered the same problem as you. The size of DOC format
will be often just half size of the origional RTF format, so I used
the following old wordbasic code to convert RTF to DOC automaticallt
when I do this kind of operation.
The doc format code is 6.
Hope this help!
Best regards
Stanley
%macro openword;
options NOXWAIT NOXSYNC XMIN;
filename word dde "winword|system" lrecl=5000;
data _null_;
length fid rc start stop time 8;
fid=fopen('word','s');
if (fid le 0) then do;
call symput("openedWord","1");
rc=system('start winword');
start=datetime();
stop=start+20; *give word up to 10 seconds to
open;
do while (fid le 0);
fid=fopen('word','s');
time=datetime();
if (time ge stop) then do;
%* put "ER" "ROR: USER could not start WORD";
fid=1;
end;
end;
end;
else call symput("openedWord","0");
rc=fclose(fid);
run;
%mend;
%macro opendoc(filename);
%local filename;
%if %length(&filename) %then %do;
data _null_;
file word;
put '[FileOpen .Name = "' "&filename" '"]';
run;
%end;
%mend;
%macro savedocas(filename1,filename2,format);
%local filename1 filename2;
%if &filename2=%str() %then %let filename2=&filename1;
%if &format=%str() %then %let format=0;
data _null_;
file word;
put '[FileOpen .Name = "' "&filename1" '"]';
put '[FileSaveAs .Name = "' "&filename2" '", .Format =
'"&FORMAT"']';
put '[FileExit 1]';
run;
%mend;
just do like this:
%openword;
%opedoc(d:\temp\test.rtf);
%savedocas(d:\temp\test.rtf,d:\temp\test.doc,6);
|