1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
| %macro QQPLOT(wk=,group=, in=, var=, titlenb=);
%if &titlenb=1 %then %do;
PROC UNIVARIATE DATA=&in.(where=(week=&wk. and grp in (%cmpres("&group.")))) noprint;
VAR &var.;
QQPLOT &var./ name="st%sysfunc(substr(&group.,6))wk&wk." nohlabel novlabel;
TITLE "&wk. Week" justify=left;
TITLE2 "Normal probability plot" ;
FOOTNOTE "&group." height=30 in ;
RUN;
%end;
%else %do;
PROC UNIVARIATE DATA=&in.(where=(week=&wk. and grp in (%cmpres("&group.")))) noprint;
VAR &var.;
QQPLOT &var./ name="st%sysfunc(substr(&group.,6))wk&wk." nohlabel novlabel;
FOOTNOTE "&group." height=30 in ;
TITLE " ";
TITLE2 "Normal probability plot" ;
RUN;
%end;
%mend QQPLOT;
%macro week1and2;
%do i=1 %to 2;
goptions device=gif gsfname=nesug%cmpres(&i.);
filename nesug%cmpres(&i.) "H:\Week%cmpres(&i.).gif";
proc greplay tc=work.tempcat nofs;
tdef newtemp des='Three panel template'
1/ulx=1 uly=75
urx=33 ury=75
llx=1 lly=25
lrx=33 lry=25
2/ulx=34 uly=75
urx=66 ury=75
llx=34 lly=25
lrx=66 lry=25
3/ulx=66 uly=75
urx=99 ury=75
llx=66 lly=25
lrx=99 lry=25
;
**************************************************************************
Above makes the template, below uses it;
template newtemp;
igout work.gseg;
gout work.gseg;
treplay
1:st002wk%cmpres(&i.)
2:st003wk%cmpres(&i.)
3:st003wk%cmpres(&i.)
name="Week%cmpres(&i.)";
quit;
%end;
%mend;
%macro week3and4;
%do i=3 %to 4;
goptions device=gif gsfname=nesug%cmpres(&i.);
filename nesug%cmpres(&i.) "H:\Week%cmpres(&i.).gif";
proc greplay tc=work.tempcat nofs;
tdef newtemp des='Two panel template'
1/ulx=9 uly=75
urx=42 ury=75
llx=9 lly=25
lrx=42 lry=25
2/ulx=58 uly=75
urx=91 ury=75
llx=58 lly=25
lrx=91 lry=25
;
**************************************************************************
Above makes the template, below uses it;
template newtemp;
igout work.gseg;
gout work.gseg;
treplay
1:st002wk%cmpres(&i.)
2:st002wk%cmpres(&i.)
name="Week%cmpres(&i.)";
quit;
%end;
%mend;
/***********************************************************************/
/************* Data Section **************/
/***********************************************************************/
proc format;
value weeknb
1="1 week"
2="2 week"
3="3 week"
4="4 week"
;
quit;
%QQPLOT(wk=1,group=gr1,in=VAS,var=vargg, titlenb=1);
%QQPLOT(wk=2,group=gr1,in=VAS,var=vargg, titlenb=1);
%QQPLOT(wk=3,group=gr1,in=VAS,var=vargg, titlenb=1);
%QQPLOT(wk=4,group=gr1,in=VAS,var=vargg, titlenb=1);
%QQPLOT(wk=1,group=gr2,in=VAS,var=vargg, titlenb=0);
%QQPLOT(wk=2,group=gr2,in=VAS,var=vargg, titlenb=0);
/***********************************************************************/
/************* Report Section **************/
/***********************************************************************/
options orientation= landscape ;
%week1and2;
%week3and4;
options noxsync noxwait xmin; *Important options to set when
using DDE;
filename wordsys dde "winword|system"; *Set up the
conversation between Word and SAS;
*The code below (borrowed from one of the many excellent DDE
papers by Koen Vyverman) Checks to see if Word is open
already, and opens it if it is not.;
data _null_;
length fid rc start stop time 8;
fid=fopen('wordsys','s');
if (fid le 0) then do;
rc=system('start winword');
start=datetime();
stop=start+10;
do while (fid le 0);
fid=fopen('wordsys','s');
time=datetime();
if (time ge stop) then fid=1;
end;
end;
rc=fclose(fid);
run;
data _null_;
file wordsys;
put '[FileNewDefault]'; *1) Open a blank Word document. WORD
must be open already!!;
put '[Filepagesetup .TopMargin=".02 in" .bottommargin="0.02 in"
.leftmargin="0.02 in" .rightmargin="0.02 in" ]'; * 2) Fix the Margins;
put '[Toggleportrait]'; *3) Turn page orientation to landscape;
put '[InsertPicture "'"H:\Week1.gif"'"]';
put '[InsertPicture "'"H:\Week2.gif"'"]';
put '[InsertPicture "'"H:\Week3.gif"'"]';
put '[InsertPicture "'"H:\Week4.gif"'"]'; *4) Inserts our graph;
put '[Editgoto "g"]';
put '[CharRight 1,1]'; *5a) Selects the Graph;
put '[Centerpara]'; *5b) Centers it;
* 6) based on default CGM size (as imported into MS WORD) of
approximately 3 inches by 4.00 inches this fits perfectly!!;
put '[FormatPicture .scaleX="100%" .scaleY="100%"]';
put '[FileSaveAs .Name = "' "H:\graphout.doc" '" .format=0]';
*Save our new file;
put '[Fileclose]';*if done;
run; |
Partager