BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
wmil
Calcite | Level 5

(see code at the bottom)

 

I build my own custom style ('mystyle') for the creation of graphs, but I don't seem to get my own user-defined style elements to work.

I am using exactly the same syntax as used in the styles.default template source code, but even though my custom style element seems to be defined just fine, it drops following note and indeed uses the default style element (in this case 'GraphTitleText'):

 

NOTE: The style element 'mygraphtitletext' in the option TEXTATTRS is invalid.  The default will be used.

I know there are several other alternatives that I could use (other than defining a custom style), e.g. changing the style element GraphTitleText itself in my custom style, but since I will be using this style in many other graphs and parts of a much more complex program, I really want to get this done in a user-defined style element.

 

Example code:

proc template;
   define style mystyle;
   parent=styles.default;
   style myGraphFonts /
      'myGraphTitleFont' = ("<sans-serif>, <MTsans-serif>",20pt,bold);
   style myGraphColors /
      'mygtext' = cx00FFFF;
   style myGraphTitleText /
      font = myGraphFonts('myGraphTitleFont')
      color = myGraphColors('mygtext');
   end;
run;

ods listing style=mystyle;

proc template;
   define statgraph histogram;
      begingraph;
         entrytitle "title 1 test" / textattrs=myGraphTitleText;
         entrytitle "title 2 test" / textattrs=GraphTitleText;
         layout overlay;
            histogram weight;
         endlayout;
      endgraph;
   end;
run;

proc sgrender data=sashelp.class
   template=histogram;
run;

Output:

 

SGRender7.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Currently, you cannot create a new style element in your own style -- you can only override the supported style elements. That is why the system generated the log message.. 

View solution in original post

2 REPLIES 2
DanH_sas
SAS Super FREQ

Currently, you cannot create a new style element in your own style -- you can only override the supported style elements. That is why the system generated the log message.. 

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 872 views
  • 0 likes
  • 2 in conversation