BookmarkSubscribeRSS Feed
nirali514
Obsidian | Level 7

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;

9 REPLIES 9
ballardw
Super User

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)

).

nirali514
Obsidian | Level 7

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;

nirali514
Obsidian | Level 7

Any other ideas? Thanks for your help!

Reeza
Super User

What version of SAS are you using?

 

proc product_status;run;
nirali514
Obsidian | Level 7
Hello, thank you for your response. I am using SAS 9.2 ts2m3.
ballardw
Super User

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

HappySASUE
Quartz | Level 8

Hi 

Do you know how to define datalabel's position, I want to put on the top of markerattrs.  It is on the top right. 

I can't find any info on google. 

 

Thanks. 

DanH_sas
SAS Super FREQ

DATALABELPOS=CENTER will draw the label on top of the marker. DATALABELPOS=TOP should center the label above the markier.

 

Hope this helps!

Dan

HappySASUE
Quartz | Level 8

Thank you very much! it works.  I notice all label fall in middle of symbol, so I set it to "top" then all labels are on the center top of symbol. 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 9 replies
  • 3319 views
  • 0 likes
  • 5 in conversation