Data visualization with SAS programming

How to control the font, size and color of X or Y lables and values in proc sgplot

Reply
Occasional Contributor
Posts: 7

How to control the font, size and color of X or Y lables and values in proc sgplot

Hello,

 

I've been using "Proc gplot" a lot to create SAS graphs. I can decide the font, size  and color of X or Y lables and values by using statement below.

 

"axis2 label=(h=1 ' ') order=('15Jan2010'd to '15Dec2015'd by month) major=(color=black height=1.5pt) minor=none value=(height=1.5 color=gray) offset=(1,1);"

 

But how to do the same things in "proc sgplot"?

 

I'm really appreciative of any helps!

 

Ethan

 

SAS Super FREQ
Posts: 925

Re: How to control the font, size and color of X or Y lables and values in proc sgplot

The axis statements for SGPLOT are inside of the procedure. For example, assuming your axis statement in your post would translate to something like the following for the X axis:

 

proc sgplot data=whatever;

xaxis display=(nolabel) values=('15Jan2010'd to '15Dec2015'd by month) valueattrs=(color=gray size=12pt) offsetmin=0.1 offsetmax=0.1;

...more statements...

run;

 

In SGPLOT, there are up to four axis statements: XAXIS, YAXIS, X2AXIS, and Y2AXIS. Plots can be assigned to different axes.

 

Hope this helps!

Dan

Occasional Contributor
Posts: 7

Re: How to control the font, size and color of X or Y lables and values in proc sgplot

Thanks Dan.

But I still don't know how to change the font, size and color for label.

 

SAS Super FREQ
Posts: 925

Re: How to control the font, size and color of X or Y lables and values in proc sgplot

On the axis statements: LABELATTRS=(color= family= size= weight= style=)

VALUEATTRS (for the tick values) has the same options.

Super User
Posts: 11,114

Re: How to control the font, size and color of X or Y lables and values in proc sgplot

Which version of SAS are you using? Options have changed significantly with each release related to the statistical graphs (SGPlot SGPanel SGrender).

Occasional Contributor
Posts: 7

Re: How to control the font, size and color of X or Y lables and values in proc sgplot

I have 9.3 1M2 and 9.4 1M3 loaded on two desktops.

 

Ask a Question
Discussion stats
  • 5 replies
  • 378 views
  • 0 likes
  • 3 in conversation