Data visualization with SAS programming

sgplot sizing font and spacing

Reply
Contributor
Posts: 37

sgplot sizing font and spacing

Is there a way to change the font and size of both the xaxis and yaxis? also, if I have two sgplots, how do I get rid of the spacing between the two in an rtf file so that they show up side by side?

 

 

ods graphics on / noborder noscale width=4in height=3.5in;

proc sgplot data= data noautolegend ;

where data=1;

histogram _MIDPT_ /freq=_OBSPCT_ fillattrs=graphdata1 (color=ltgray) ;

density _MIDPT_ / type=normal lineattrs=graphdata1 (color=black);

xaxis label = "X" ;

yaxis label = "Y" min= 0 max=60 offsetmin=0 offsetmax=0 values = (0 to 60 by 10);

title font = "Times New Roman" height=10pt "Data 1";

run;

 

ods graphics on / noborder noscale width=4in height=3.5in;

proc sgplot data=data noautolegend;

where data=3;

histogram _MIDPT_ /freq=_OBSPCT_ fillattrs=graphdata1 (color=ltgray) ;

density _MIDPT_ / type=normal lineattrs=graphdata1 (color=black);

xaxis label = "X";

yaxis label = "Y" min= 0 max=60 offsetmin=0 offsetmax=0 values = (0 to 60 by 10);

title font = "Times New Roman" height=10pt "Data 3";

run;

ods graphics off;

Super User
Posts: 13,084

Re: sgplot sizing font and spacing

Posted in reply to nirali514

I'll answer the second question first: Use SGPANEL and PANELBY your DATA variable where data in (1,3) (assuming there are other values). The panelby would include options ONEPANEL and Rows=1;

 

LABELATTRS controls the appears of the axis labels (example LABELATTRS=(Color=Green Family=Arial Size=8
        Style=Italic Weight=Bold)

) as part of the axis statement or to use a style element

LABELATTRS=GraphTitleText

and

VALUEATTRS controls the appearance of tick value labels (example VALUEATTRS=(Color=Green Family=Arial Size=8
        Style=Italic Weight=Bold)

).

Contributor
Posts: 37

Re: sgplot sizing font and spacing

It doesn't seem like my SAS version offers labelattrs unfortunately my log says below.

 

 

99411 histogram _MIDPT_ /freq=_OBSPCT_ fillattrs=graphdata1 (color=ltgray) scale =

99411! percent ;

99412 density _MIDPT_ / type=normal lineattrs=graphdata1 (color=black) lineattrs=

99412! (thickness = 0.5);

99413 xaxis label = "Response" LABELattrs=(Color=Green Family=Arial Size=8

---------- -

1 22

76

99413! Style=Italic Weight=Bold) ;

WARNING 1-322: Assuming the symbol LABEL was misspelled as LABELattrs.

ERROR 22-322: Expecting a quoted string.

ERROR 76-322: Syntax error, statement will be ignored.

99414 yaxis label = "Percent of Sample Within Range" min= 0 max=60 offsetmin=0

99414! offsetmax=0 values = (0 to 60 by 10);

99415 title font = "Times New Roman" height=10pt "Panel 1";

99416 run;

Contributor
Posts: 37

Re: sgplot sizing font and spacing

Posted in reply to nirali514

Any other ideas? Thanks for your help!

Super User
Posts: 22,874

Re: sgplot sizing font and spacing

Posted in reply to nirali514

What version of SAS are you using?

 

proc product_status;run;
Contributor
Posts: 37

Re: sgplot sizing font and spacing

Hello, thank you for your response. I am using SAS 9.2 ts2m3.
Super User
Posts: 13,084

Re: sgplot sizing font and spacing

Posted in reply to nirali514

nirali514 wrote:
Hello, thank you for your response. I am using SAS 9.2 ts2m3.

Really time to upgrade.

 

Or learn to modify ODS styles, not a trivial task as you need to identify each element in a style that affects the bit you want to modify. Then create an entire new ODS style inheriting the properties of the style you want to base on and modify the specific characteristics.

Ask a Question
Discussion stats
  • 6 replies
  • 151 views
  • 0 likes
  • 3 in conversation