Data visualization with SAS programming

Title is hidden behind graph - how to bring out?

Reply
N/A
Posts: 0

Title is hidden behind graph - how to bring out?

I am plotting a couple of line plots using proc gplot. I am rotating the graphs to a landscape orientation and outputting to pdf. My problem is that the graphs take up too much real estate and the title gets hidden. I tried playing around with some of the hsize, horigin, etc. kinds of options to no avail. Does anyone have any ideas? Here is the code:

ods listing close;

ods html close;
ods pdf file='c:\PlotBRet.pdf' columns=2;

GOPTIONS xpixels=0 ypixels=0 ROTATE=LANDSCAPE HTITLE=1;

/* symbols defs skipped for pasting */

Legend1 FRAME;
Axis1 STYLE=1 WIDTH=1 MINOR=NONE;
Axis2 STYLE=1 WIDTH=1 MINOR=NONE;
Axis3 STYLE=1 WIDTH=1 MINOR=NONE;

TITLE;
TITLE1 "Barra Factor Returns as of %SYSFUNC(DATE(), EURDFDE9.)";
FOOTNOTE;
FOOTNOTE1;

ods proclabel 'BF Returns';

PROC GPLOT DATA = BFRET NOCACHE ;
PLOT (EV EY G L)*EndDate / NOFRAME Overlay VZERO VAXIS=AXIS1 VREF=0 HAXIS=AXIS2 SKIPMISS LEGEND=LEGEND1;
PLOT (M S V Vo Y)*EndDate / NOFRAME Overlay VZERO VAXIS=AXIS1 VREF=0 HAXIS=AXIS3 SKIPMISS LEGEND=LEGEND1;
RUN;


ods pdf close;
ods html;
ods listing;
TITLE; FOOTNOTE;
GOPTIONS RESET=ALL;
SAS Super FREQ
Posts: 8,645

Re: Title is hidden behind graph - how to bring out?

Hi:
Rather than rotate with GOPTIONS, I rotated the PDF output and then with columns=2, had enough real estate to get the two plots side-by-side using SASHELP.PRDSALE. (With only 2 numeric variables, I took out the OVERLAY option.)

cynthia
[pre]
ods _all_ close;

options orientation=landscape
topmargin=.5in bottommargin=.5in leftmargin=.5in rightmargin=.5in;
ods pdf file='c:\temp\PlotBRet.pdf' columns=2;

GOPTIONS reset=all HTITLE=1;

/* symbols defs skipped for pasting */

Legend1 FRAME;
Axis1 STYLE=1 WIDTH=1 MINOR=NONE;
Axis2 STYLE=1 WIDTH=1 MINOR=NONE;
Axis3 STYLE=1 WIDTH=1 MINOR=NONE;

TITLE;
TITLE1 "Barra Factor Returns as of %SYSFUNC(DATE(), EURDFDE9.)";
FOOTNOTE;
FOOTNOTE1;

ods proclabel 'BF Returns';

PROC GPLOT DATA = sashelp.prdsale NOCACHE ;
where year = 1994 and region='EAST' and country='CANADA' and product='DESK';
PLOT (actual)*Month / NOFRAME VZERO VAXIS=AXIS1 VREF=0 HAXIS=AXIS2 SKIPMISS LEGEND=LEGEND1;
PLOT (predict)*Month / NOFRAME VZERO VAXIS=AXIS1 VREF=0 HAXIS=AXIS3 SKIPMISS LEGEND=LEGEND1;
RUN;

ods pdf close;

ods listing;
TITLE; FOOTNOTE;
GOPTIONS RESET=ALL;
[/pre]
N/A
Posts: 0

Re: Title is hidden behind graph - how to bring out?

Thanks Cynthia. I knew I had tried something like this, but couldn't recall the result. I tried it again and I get an Error: Device Not Specified message in the log. It seems to be related to the "reset=all" in GOPTIONS statement, because I can remove that and it runs (but I'm back to my original problem of the title being hidden at that point). Any thoughts as to why that would occur.

--Charlie
SAS Super FREQ
Posts: 8,645

Re: Title is hidden behind graph - how to bring out?

Hi:
You can fix the device issue by using an explicit DEVICE= specification after the RESET=ALL (or I believe it might also work if you moved the GOPTIONS statement BEFORE the ODS PDF statement):
[pre]
goptions reset=all device=sasprtc htitle=1;
[/pre]

However, I ran my code in SAS 9.2, Phase 2 release and did not get an ERROR message or warning in the LOG:
[pre]
4326 ods _all_ close;
4327
4328 %put &sysvlong;
9.02.02M2P090109

4329
4330 options orientation=landscape topmargin=.5in
4330! bottommargin=.5in leftmargin=.5in rightmargin=.5in;
4331 ods pdf file='c:\temp\PlotBRet2.pdf' columns=2;
NOTE: Writing ODS PDF output to DISK destination
"c:\temp\PlotBRet2.pdf", printer "PDF".
4332
4333 GOPTIONS reset=all htitle=1;
4334
4335 /* symbols defs skipped for pasting */
4336
4337 Legend1 FRAME;
4338 Axis1 STYLE=1 WIDTH=1 MINOR=NONE;
4339 Axis2 STYLE=1 WIDTH=1 MINOR=NONE;
4340 Axis3 STYLE=1 WIDTH=1 MINOR=NONE;
4341
4342 TITLE;
4343 TITLE1 "Barra Factor Returns as of %SYSFUNC(DATE(),
4343! EURDFDE9.)";
4344 FOOTNOTE;
4345 FOOTNOTE1;
4346
4347 ods proclabel 'BF Returns';
4348

NOTE: There were 24 observations read from the data set
SASHELP.PRDSALE.
WHERE (year=1994) and (region='EAST') and
(country='CANADA') and (product='DESK');
NOTE: PROCEDURE GPLOT used (Total process time):
real time 3:17.76
cpu time 1.76 seconds


4349 PROC GPLOT DATA = sashelp.prdsale NOCACHE ;
4350 where year = 1994 and region='EAST' and country='CANADA'
4350! and product='DESK';
4351 PLOT (actual)*Month / NOFRAME VZERO VAXIS=AXIS1 VREF=0
4351! HAXIS=AXIS2 SKIPMISS LEGEND=LEGEND1;
4352 PLOT (predict)*Month / NOFRAME VZERO VAXIS=AXIS1 VREF=0
4352! HAXIS=AXIS3 SKIPMISS LEGEND=LEGEND1;
4353 RUN;

4354
4355
4356 ods pdf close;
NOTE: ODS PDF printed 1 page to c:\temp\PlotBRet2.pdf.
4357
4358 ods listing;
4359 TITLE; FOOTNOTE;
4360 GOPTIONS RESET=ALL;
[/pre]

This leads me to wonder 1) what version of SAS you're using and 2) what operating system you're using and 3) in what other context you might be submitting the code (such as from within SAS Enterprise Guide or as a SAS Stored Process).

However, at this point I have no idea why your title is being obscured. Without knowing the units that are set for your SAS/GRAPH goptions, it is hard to know what HTITLE=1 means -- the UNITS for HTITLE could be in CELLS, CM, IN, PCT or PT -- so a few things you could try are 1) to specify an explicit unit for size for the HTITLE= option:
[pre]
HTITLE=14pt
HTITLE=2pct
[/pre]
and see whether the title is still obscure;
[/pre]

or 2) take HTITLE out altogether and allow the style template (if you are using SAS 9.2) to control the titles and see whether the title is still obscure; or

or 3) take HTITLE out altogether and alter the TITLE statement:
[pre]
TITLE1 h=2pct "Barra Factor Returns as of %SYSFUNC(DATE(), EURDFDE9.)";
TITLE1 h=14pt "Barra Factor Returns as of %SYSFUNC(DATE(), EURDFDE9.)";
[/pre]

At this point, your best bet for help might be to open a track with Tech Support. They can help you with solutions that will be specific to your version of SAS and your operating system. To open a track with Tech Support, fill out the form at this link:
http://support.sas.com/ctx/supportform/createForm

cynthia
N/A
Posts: 0

Re: Title is hidden behind graph - how to bring out?

OK, thanks Cynthia. That more or less did it. Just for reference, I'm using Enterprise Guide and currently running the program locally rather than on our server. It's a Windows platform and the SAS version is 9.1.3 SP4.

This last iteration fixed the title, but then added Titles on each plot and also messed up the legend and x-axis in terms of the font. I'm assuming I can fix that though.

Thanks for your help!

--Charlie
Post a Question
Discussion Stats
  • 4 replies
  • 188 views
  • 0 likes
  • 2 in conversation