BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
KentaMURANAKA
Pyrite | Level 9

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;

ex1.PNGex2.PNG

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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.

View solution in original post

9 REPLIES 9
ballardw
Super User

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.

KentaMURANAKA
Pyrite | Level 9

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!!

KentaMURANAKA
Pyrite | Level 9

Thnak you!

FYI, I uploaded my changed code & outputex1.PNG.

(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;
GraphGuy
Meteorite | Level 14

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)?

 

KentaMURANAKA
Pyrite | Level 9

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.)

KentaMURANAKA
Pyrite | Level 9

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

KentaMURANAKA
Pyrite | Level 9

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.

ex1.PNGex2.PNG

GraphGuy
Meteorite | Level 14

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!

 

KentaMURANAKA
Pyrite | Level 9

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!!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 993 views
  • 1 like
  • 3 in conversation