Date: Fri, 29 Jun 2007 03:12:26 -0400
Reply-To: Joe Whitehurst <joewhitehurst@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Whitehurst <joewhitehurst@GMAIL.COM>
Subject: Re: How to copy the graph from SAS to word document
In-Reply-To: <NIECJIJPHOLPKIFCPLHOIEFNJHAA.d@dkvj.biz>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hui,
Apparently David is a novice when it comes to SAS/Graph so I would not pay
much attentiopn to him. If you want to put high resolution, high quality
SAS/Graph output into MS Word, take a look at the following example of how
to do just that:
data sasuser.final_pdif_3i2_3i3_3i4_3i5_320;
retain xx 1;
set sasuser.final03i2_pdif_320
sasuser.final03i3_pdif_320
sasuser.final03i4_pdif_320
sasuser.final03i5_pdif_320;
n+1;
output;
if n=3 then do;
xx+1;
n=0;
end;
run;
proc sort data=sasuser.final_pdif_3i2_3i3_3i4_3i5_320;
by xx;;
/*
data sasuser.final_320_320;
set sasuser.final_320_320;
if cmean_320=. then cmean_320=cmean_320;
run;
*/
%let gsfpath=c:\a00321\graphics0320\;
%let gsfname=eff03i2_3i3_3i4_3i5_320_pdf.emf;
filename gsfname "&gsfpath&gsfname";
goptions reset=all display border
targetdevice=win
Device = emf
gsfname = gsfname
gsfmode = replace
Cback = white
FText = 'Times New Roman/bold'
Rotate = Landscape
gunit = pct
htext = 2;
*symbol1 font=marker value=U i=hilo r=1 l=1 h=2 c=magenta;
*symbol6 font=marker value=U i=hilo r=1 l=1 h=2 c=magenta;
symbol1 font=marker value=U i=hilo r=1 l=1 h=2 c=blue;
symbol2 font=marker value=U i=hilo r=1 l=1 h=2 c=orange;
symbol3 font=marker value=U i=hilo r=1 l=1 h=2 c=green;
symbol4 font=marker value=U i=hilo r=1 l=1 h=2 c=black;
symbol5 font=marker value=U i=hilo r=1 l=1 h=2 c=blue;
symbol6 font=marker value=U i=hilo r=1 l=1 h=2 c=orange;
symbol7 font=marker value=U i=hilo r=1 l=1 h=2 c=green;
symbol8 font=marker value=U i=hilo r=1 l=1 h=2 c=black;
symbol9 font=marker value=U i=hilo r=1 l=1 h=2 c=blue;
symbol10 font=marker value=U i=hilo r=1 l=1 h=2 c=orange;
symbol11 font=marker value=U i=hilo r=1 l=1 h=2 c=green;
symbol12 font=marker value=U i=hilo r=1 l=1 h=2 c=black;
symbol13 font=marker value=U i=hilo r=1 l=1 h=2 c=blue;
symbol14 font=marker value=U i=hilo r=1 l=1 h=2 c=orange;
symbol15 font=marker value=U i=hilo r=1 l=1 h=2 c=green;
symbol16 font=marker value=U i=hilo r=1 l=1 h=2 c=black;
legend1 label=none
value=none
shape=line(.000000001)
position=(outside bottom center);
data anno;
%dclanno;
%system(2,1,3);
%line(4.25,0,4.25,100,black,1,1);
%system(1,1,3);
%line(50,0,50,100,black,1,1);
%system(2,1,3);
%line(12.75,0,12.75,100,black,1,1);
%system(2,2,3);
%label(2,1.35,'Week 1',black,0,0,4,'Times New Roman/bold',5);
%label(6.5,1.35,'Week 2',black,0,0,4,'Times New Roman/bold',5);
%label(10.5,1.35,'Week 3',black,0,0,4,'Times New Roman/bold',5);
%label(15,1.35,'Week 4',black,0,0,4,'Times New Roman/bold',5);
%system(2,2,3);
%sequence(b);
%bar2(0,0,17,.8,yellow,0,l1,1);
%sequence(a);
run;
axis1 label = (a=0 r=0 h=2.5 font='Times New Roman/bold' 'Pair-Wise'
j=c 'Differences')
order = (-.4 to 1.4 by .10)
value = (h=3 f='Times New Roman/bold')
minor = none
length=78pct
;
axis2 label =none/* (j=c h=3 font='Times New Roman/bold' "Treatment")*/
order=(0 to 17 by 1)
minor=none
value= (h=1 f='Times New Roman/bold'
' '
color=blue
'IR bid 7mg'
color=orange
'IR bid 10mg'
color=green
'IR bid 15mg'
color=black
'ER qd 35mg'
color=blue
'IR bid 7mg'
color=orange
'IR bid 10mg'
color=green
'IR bid 15mg'
color=black
'ER qd 35mg'
color=blue
'IR bid 7mg'
color=orange
'IR bid 10mg'
color=green
'IR bid 15mg'
color=black
'ER qd 35mg'
color=blue
'IR bid 7mg'
color=orange
'IR bid 10mg'
color=green
'IR bid 15mg'
color=black
'ER qd 35mg' ' ' )
length=87pct
;
title1 f='Times New Roman/bold' h=3.35
'Summary of Least Square Mean Pair-Wise Differences from Placebo For';
title2 h=3.35 f='Times New Roman/bold'
'Reflective Total 4 Symptom Score Overall (a.m./p.m.) and the 95% CI by
Week';
title3 h=1 ' ';
title4 f='Times New Roman/bold' h=3
'Efletirizine Study A00320';
proc gplot data=sasuser.final_pdif_3i2_3i3_3i4_3i5_320 anno=anno;
plot pdif2*xx=treatment
/
legend=legend1
vaxis=axis1
haxis=axis2
autovref;
run;
quit;
options noxwait noxsync;
data _null_;
/******************************************************************************************/
/*Open
WORD
*/
/******************************************************************************************/
rc=system('"C:\Program Files\Microsoft Office\office10\winword.exe"');
put rc=;
wait=sleep(5);
run;
/*******************************************************************************************/
/*Allocate the DDE SYSTEM Topic. Allows WORDBASIC Commands to be sent to
WORD via DDE. */
/*In Word 97 and later versions, the WORDBASIC Commands are treated as
methods for the VBA */
/*WORDBASIC
OBJECT.
*/
/*******************************************************************************************/
filename cmds dde 'winword|system';
/*******************************************************************************************/
/*Open New Doc with Default
Template */
/*******************************************************************************************/
data _null_;
cmd='[FileNewDefault]';
file cmds;
put cmd;
run;
/*******************************************************************************************/
/*Set To
Landscape
*/
/*******************************************************************************************/
data _null_;
cmd='[TogglePortrait]';
file cmds;
put cmd;
run;
/*******************************************************************************************/
/*Insert
Graph
*/
/*******************************************************************************************/
data _null_;
file cmds;
cmd='[InsertPicture.Name=' || '"' || "&gsfpath&gsfname" || '"' || ']';
put cmd;
run;
/*******************************************************************************************/
/*Save Document With
Graph */
/*******************************************************************************************/
data _null_;
length worddoc $30;
worddoc=tranwrd("&gsfname",'.emf','.doc');
file cmds;
cmd='[FileSaveAs.Name=' || '"' || "&gsfpath" ||worddoc || '",
.Format=0' || ']';
put cmd;
run;
/*******************************************************************************************/
/*Close
Word
*/
/*******************************************************************************************/
data _null_;
file cmds;
cmd='[FileExit(1)]';
put cmd;
run;
On 6/29/07, David Johnson <d@dkvj.biz> wrote:
>
> We've been discussing this at some length in the last 48 hours.
>
> If you search the archives for a reply I gave on GReplay, Template and
> device drivers you'll see I discuss graphics drivers, creating and
> modifying
> your own versions and the various resolutions available for each.
>
> As I recall, there are around 4 different versions of a GIF driver and if
> the resolution isn't sufficient, create a new one that is correct and
> replay
> the object to the device to create an image file.
>
>
> If you have questions after you have read the answers already given, then
> write again.
>
> Kind regards
>
> David
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of
> huizhao_liu@YAHOO.COM
> Sent: Friday, 29 June 2007 7:56 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: How to copy the graph from sas to word document
>
>
> Hi, everyone,
>
> My name is Hui Zhao, I am a postdoctoral fellow in the MD Anderson
> Cancer Center. I aligned boxplots using sas proc greplay in one graph.
> It looks nice in SAS window, however, I can not copy and paste it in
> microsoft word file.
>
> I also tried to save the output as gif format and create a pdf file
> from that image. The resolution was too low.
>
> Please advise me how to output the sas graph to word file. Thanks a
> lot.
>
> Hui
>