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;
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)
).
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;
Any other ideas? Thanks for your help!
What version of SAS are you using?
proc product_status;run;
@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.
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.
DATALABELPOS=CENTER will draw the label on top of the marker. DATALABELPOS=TOP should center the label above the markier.
Hope this helps!
Dan
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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: