BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi, I was trying to change the axises format (namely Thickness and font size) by modifying the default graph template. Can anyone suggest how could I do that? I am using Layout Overlay statements, but not sure which Options (or sub-options) may help.

Thanks!
5 REPLIES 5
Bill
Quartz | Level 8
if you look up the axis statement in SAS help, you will find a plethora of options to control the appearance of the axes.
deleted_user
Not applicable
While there may have several possibles ways to do it, but I am not sure where to start from.

I was using the Statistical style template and was hoping there is an straightforward way to override the default settings. Any ideas if I can change it by adding an Options functions or if I have to define my own style.

Many thanks!
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Lots of very useful (and free!) information and SAS-hosted DOC on the Support http://support.sas.com/ website. Some creative searches either using the website's SEARCH box or Google will yield results for your review.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

statistical style template site:sas.com
Cynthia_sas
SAS Super FREQ
Hi:
You can either change the style settings in the Graph Template Language for using the XAXISOPTS and YAXISOPTS statements (and other statements for changing text attributes, such as in the label and data values). Documentation here:
http://support.sas.com/documentation/cdl/en/grstatug/62464/HTML/default/n1f71f6e9v037an1jy274v66z4r1...
http://support.sas.com/documentation/cdl/en/grstatug/62464/HTML/default/p1b7qx0s2cynrgn1fy2ugk5rz2ek...
http://support.sas.com/documentation/cdl/en/grstatug/62464/HTML/default/p1wp0lm93sf0kan1266430ixhbu1...

OR you can alter the style template used for creating your output.

If you have no conflicting settings in your Graph Template, then the style settings in the style template will be used. In order to change your style template, you will need to know which Graph style element to change. Luckily, you can ALSO find this information in the documentation:
http://support.sas.com/documentation/cdl/en/grstatug/62464/HTML/default/p18c2hn0ybnntyn1t6aitke3f0l6...

and you will see in the above doc that the elements of interest are: GraphAxisLines, GraphValueText, GraphLabelText and GraphDataText (to name just a few)

To get you started with style templates, you might want to search for user group papers on creating style templates. With the recent introduction of ODS GRAPHICS, there are quite a few examples out there of creating custom style templates for use with ODS GRAPHICS.

The example below uses a custom STYLE template with SGPLOT. Every style element is a different color and every font is either a different color, a different font or a different size. So you should be able to figure out which style elements are controlling which pieces of the output -- based on visual clues.

cynthia
[pre]
ods path work.tmp(update)
sasuser.templat(update)
sashelp.tmplmst(read);

proc template;
define style styles.thick;
parent=styles.statistical;
class GraphFonts /
'GraphDataFont' = ("Courier New, ",7pt)
'GraphValueFont' = ("Helvetica, ",11pt)
'GraphLabelFont' = ("Helvetica, ",9pt,bold italic)
'GraphTitleFont' = ("Courier New, ",12pt,bold);

class GraphFit /
linethickness = 5px
contrastcolor = pink;

class GraphAxisLines /
linethickness = 6px
contrastcolor = red;

class GraphDataText /
font = GraphFonts("GraphDataFont")
color = purple;

class GraphLabelText /
font = GraphFonts("GraphLabelFont")
color = green;

class GraphValueText /
font = GraphFonts("GraphValueFont")
color=blue;

end;
run;

** Make variable to only label certain cholesterol levels with;
** the gender (instead of labelling every data point).;
data heart;
set sashelp.heart;
if cholesterol le 125 then labl = sex;
else if cholesterol ge 400 then labl=sex;
else labl=' ';
run;

ods listing style=styles.thick;

ods html path='.' (url=none)
file='usethick.html' style=styles.thick;
proc sgplot data=heart;
title '1) Changing Attributes with a Style';
reg y = ageatdeath x=cholesterol/ clm datalabel=labl;
yaxis values=(60 to 95 by 5);
run;
ods _all_ close;
[/pre]
Risks
Calcite | Level 5
Hi

I usually this template to increase the Font Size of the axis titles and values.

proc template;
define style MyStyleDefault;
parent=Styles.statistical;
style GraphLabelText from GraphLabelText / fontsize = 10px;
style GraphValueText from GraphValueText / fontsize = 8px;
end;
run;


ods html style = MyStyleDefault;

Many thanks,

Kriss

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 994 views
  • 0 likes
  • 5 in conversation