Date: Tue, 28 Jan 2003 11:40:33 -0800
Reply-To: JP <jplecruguel@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: JP <jplecruguel@HOTMAIL.COM>
Organization: http://groups.google.com/
Subject: ODS need help: create multiple file in a macro
Content-Type: text/plain; charset=ISO-8859-1
Hi all,
Thanks to you, I was able to put 1 graph per patient in .jpg and some
variables related to each patient on 1 page.
I use ODS to create 1 RTF file for each patient. So my ODS statement
is in a macro. And I change the name of the RTF file at each loop.
It produces each page fine, but I can't get to name and save/close
each file created. (I only want it to create the file, not open
neither view it yet).
I am not too good with ODS. On my system, when I use ODS, such as:
ods listing close;ods rtf file='B';
PROC FREQ;TABLES datev1;WHERE ramq;FORMAT datev1 date8.;RUN;
ods rtf close;ods listing;
It pops up a window to associate the file to a program (I have to pick
Word and it opens it in word).
(Could you please mail a copy of the answer to jplecruguel @
hotmail.com , mind the spaces)
JP
Here is the code I am using:
In fact, it only creates 1 file. With the last patient's information,
but the file is given the first id as a name for it.
Goptions reset=(axis, legend, pattern, symbol, title, footnote)
norotate
hpos=0 vpos=0 htext= ftext= ctext= target= gaccess= gsfmode=
ftext=swissb htitle=1 htext=1;
Goptions Device=WIN ctext=blue TARGET=winprtC
graphrc interpol=NONE;
Goptions Htext=0.75 gsfmode=replace display GOUTMODE = REPLACE;
SYMBOL1 I = NONE V=DOT COLOR=RED WIDTH = 10 HEIGHT = 1 LINE = 1;
SYMBOL2 I = NONE V=+ COLOR=BLACK WIDTH = 10 HEIGHT = 1 LINE = 1;
filename gsffile "test.jpg";
goptions gsfname=gsffile gsfmode=replace device=jpeg hsize=17cm
vsize=15cm;
%MACRO graf(anc);
*pick the ith record in a file;
%lireanc(&i);
PROC GPLOT DATA =out ;
TITLE &anc;
PLOT md*dt=hum/ VAXIS = -30 TO 0 BY 5 HAXIS = '01JAN90'd TO '01JAN04'd
BY 365.25;;
WHERE id ="&anc";
FORMAT dt yymm5.;FORMAT hum mes_f.;
RUN;
QUIT;
proc template;
define style myRTF/store=work.templates;
parent=styles.rtf;
style table from table/
preimage="test.jpg";
end;
run;
ods path (prepend) work.templates;
ods rtf file="doc_&anc..rtf" style=myRTF;
PROC PRINT DATA=don2 LABEL NOOBS;
VAR ID phy1-phy2
eye diagnosis datebirth age_v1 gender ethnic
delay
o_pb1-o_pb4
pigm_glauc pseudo_exfo tube_shunt trabeculectomy trabeculoplasty
iridoto syst_hypertension
comments;
WHERE id ="&anc";
RUN;
ods rtf close;
%MEND graf;
%MACRO lireanc(i);
%GLOBAL anc;
DATA temps;
SET un (KEEP = id);
IF _N_ = &i THEN DO;
CALL SYMPUT('anc',id);
* CALL SYMPUT('i',I);
END;
RUN;
%MEND lireanc;
%MACRO lance(x);
%DO i = 1 %TO &x;
%graf(&i);
%END;
%MEND;
%lance(2);