Good morning,
Am tying to get a handle on how to move a rectangle around in an ODS region using GTL. I defined a region 5" wide and 1.75" high and want to draw the rectangle in the middle next to the left side.
The code I have so far is:
%let path=c:\temp\;
ods pdf file="&path.test.pdf";
ods layout absolute x=0 y=0 height=8.48in;
ods region y=1.1in x=.5in width=5in height=1.75in style={background=cyan};
proc template;
define statgraph vennleft;
begingraph / drawspace = layoutpercent ;
entrytitle '';
layout region / opaque=false;
drawrectangle x = 0 y = 25 width = 28 height = 23 / display = (outline) anchor = BottomLeft;
endlayout;
endgraph;
end;
run;
proc sgrender data = SasHelp.Cars template = vennleft;
run; quit;
ods layout end;
ods pdf close;
What I get is a square in the middle third of the rectangle and the drawrectangle output appears in that per the attached image. How do I tell it to use the entire region?
Thanks much!
--Ben
I believe you are getting what you are coding. ODS LAYOUT and REGION are totally independent of the GTL LAYOUT REGION. Everything the SGRENDER produces goes into the ODS REGION you have defined. GTL only knows of the graph canvas which is the white area in the middle. Everything you specify inside the GTL code can only render inside the graph canvas, which is then placed inside the ODS Region you have defined.
drawrectangle x = 0 y = 25 width = 28 height = 23
Sure looks like you want to draw something almost square: width=28 and height=23 means that the x and y dimensions are almost the same=> squarish. The image you show has the "square" actuall just a tad wider than the height. Maybe you mean width=58??
This was just a test, but changing width to 58 makes the rectangle a bit wider; the x/y origin of it still remains in the center of the layout region. I'd like to figure out how to position it's starting point to the left side of the region shown in cyan.
Thanks!
--Ben
I believe you are getting what you are coding. ODS LAYOUT and REGION are totally independent of the GTL LAYOUT REGION. Everything the SGRENDER produces goes into the ODS REGION you have defined. GTL only knows of the graph canvas which is the white area in the middle. Everything you specify inside the GTL code can only render inside the graph canvas, which is then placed inside the ODS Region you have defined.
Just found out what it was; a previous proc in the job had specified a width and height on an ods graphics statement. Adding:
ods graphics on / width=5in height=1.75in;
did the trick.
Thanks!
--Ben
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.