Hi, there:
I am trying to generate flow chart by using PROC GSLIDE (SAS9.3),
but my following code generates spaces on figure's upper & lower space, which I do not want.
I have no idea about how to exclude them. Please help me.
Thank you in advance.
options
nonumber
nodate
noxwait
noxsync
nocenter
mprint
;
options
nodate
papersize="A4"
orientation=portrait
topmargin=3.0cm bottommargin=3.0cm leftmargin=2.5cm rightmargin=2.5cm
;
/*goptions gunit=cells hsize=6.3in vsize=5.3in;*/
%annomac;
%macro add_element(x=, y=, width=, height=, text=);
%rect(&x., &y., &x.+&width., &y.+&height., black, 1, 0.2);
%let i=1;
%do %until(%qscan(&text., &i., "|")=);
%label(&x.+0.5, &y.+&height.-&i.+0.5, "%qscan(&text., &i., "|")", black, 0, 0, 1, Times New Roman, 6);
%let i=%eval(&i.+1);
%end;
%mend add_element;
data final;
length function color style $16. text $60.;
retain xsys '6' ysis '6' hsys '6' when 'a' line 1 function 'label';
%add_element(x=5.0, y=36.5, width=30.0, height=1.5, text=%str( # of Subjects Enrolled));
%add_element(x=5.0, y=35.0, width=30.0, height=1.5, text=%str( XX));
%add_element(x=5.0, y=28.5, width=30.0, height=1.5, text=%str( # of Completers));
%add_element(x=5.0, y=27.0, width=30.0, height=1.5, text=%str( XX));
%add_element(x=40.0, y=27.0, width=35.0, height=3.0, text=%str( # of Subjects Discontinued| From the Study));
%add_element(x=40.0, y=25.5, width=35.0, height=1.5, text=%str( XX));
%line(19.5, 35.0, 19.5, 30.0, black, 1, 1);
%line(19.5, 32.5, 57.0, 32.5, black, 1, 1);
%line(57.0, 32.5, 57.0, 30.0, black, 1, 1);
run;
ods rtf file="XXXXX\test.rtf";***** Please specify Your Own Folder ;
proc gslide annotate=final;
run;
quit;
ods listing close;
ods rtf close;
Since Goptions remain in effect until you explicitly reset them you may need to address the space you are using.
You may need to run PROC GOPTIONS to look at the Hsize/Vsize Xmax/Ymax Xpixels/Ypixels settings to see what the current values are then reset one of them to your desired height.
Are you aware of the %annomac macros?
It appears that you may be attempting to write one or more macros that do what SAS has supplied macros to accomplish.
If you don't include borders to see which is the actual image created you may also be running into default margins from your program rendering the RTF file which may be adding an inch or more to margins.
Since Goptions remain in effect until you explicitly reset them you may need to address the space you are using.
You may need to run PROC GOPTIONS to look at the Hsize/Vsize Xmax/Ymax Xpixels/Ypixels settings to see what the current values are then reset one of them to your desired height.
Are you aware of the %annomac macros?
It appears that you may be attempting to write one or more macros that do what SAS has supplied macros to accomplish.
If you don't include borders to see which is the actual image created you may also be running into default margins from your program rendering the RTF file which may be adding an inch or more to margins.
Hi, ballardw-san, Robert-san, there:
Thank you for advice.
I overviewed PROC GOPTIONS reference, and I noticed that my code generates graph by using X & Y coordinates from lower left orgin point, which I had fogot.
I changed Y values in %ADD_ELEMENT, and accomplished my objective.
Thank you!!
Thnak you!
FYI, I uploaded my changed code & output.
(changed to Y minus 20)
data final;
length function color style $16. text $60.;
retain xsys '6' ysis '6' hsys '6' when 'a' line 1 function 'label';
%add_element(x=5.0, y=16.5, width=30.0, height=1.5, text=%str( # of Subjects Enrolled));
%add_element(x=5.0, y=15.0, width=30.0, height=1.5, text=%str( XX));
%add_element(x=5.0, y=8.5, width=30.0, height=1.5, text=%str( # of Completers));
%add_element(x=5.0, y=7.0, width=30.0, height=1.5, text=%str( XX));
%add_element(x=40.0, y=7.0, width=35.0, height=3.0, text=%str( # of Subjects Discontinued| From the Study));
%add_element(x=40.0, y=5.5, width=35.0, height=1.5, text=%str( XX));
%line(19.5, 15.0, 19.5, 10.0, black, 1, 1);
%line(19.5, 12.5, 57.0, 12.5, black, 1, 1);
%line(57.0, 12.5, 57.0, 10.0, black, 1, 1);
run;
Do you want the boxes in the flow chart to be bigger (taller)?
Or do you want to outside dimensions of the entire gslide to be smaller (shorter)?
Hi, Robert-san, Ballardw-san:
Thank you for your reply.
I think I want to do the latter.
(I have already known how to bigger boxes in flow chart.)
Hi ,there:
When submitting "GOPTIONS gunit=cells hsize=6.3in vsize=5.3in" with my other code,
Figure's upper space looks like good, but lower space remains.
I tried to make VSIZE smaller, but result was not good.
Mmm
Hi, Robert-san, ballardw-san, there:
I uploaded more concrete example.
I want to exclude lower space now.
Does someone have more concrete ideas? Please.
Thank you in advance.
I'm not really familiar with the macros you're using to place the text & draw the boxes, but it looks like they're probably using x-coordinates on a 0-100 scale. Therefore I think you'll need to make your graph dimensions smaller in the y-direction (I would typically use "goptions ypixels=" since I am typically creating png output), and then come up with new hard-coded y-coordinates. Sorry this is a lot of work for you, but you're doing a totally custom graph, by "drawing" boxes and placing text in them ... therefore no changes are going to be easy!
Hi, Robert-san:
Thank you for your help.
Like you said, I changed Y-axis scale & output position, and resolved above.
Same as you, I am not familiar with annotate macro, and I referred to attached document. FYI
Anyway, Thanks!!
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.