BookmarkSubscribeRSS Feed
AndersBergquist
Quartz | Level 8
I am trying to do a grouped barchart in GTL. The problem is I want specific corporate colors for each group. In a non-grouped barchart I can use fillattrs=(color=yellow), it will not work with fillattrs=(color=yellow red) as it does in gbar.

Is there a way to easy change the color to the one I want? I have tried to plough through the documentation, but I do not find any helpful, just lot of descriptions of the inner life of templates and how to change other attributes. The problem is when I try these codes in my concept, it does not work.

Is there an easy way to change the colors in a grouped barchart (or other grouped graphs) in GTL.

Thanks in advance.
9 REPLIES 9
DanH_sas
SAS Super FREQ
Take a look at my paper "Secrets of the SG Procedures" (http://support.sas.com/resources/papers/proceedings09/324-2009.pdf). The SG procedure use GTL to create the output. In the paper, you will see some techniques for creating grouped bar charts. As for specifying the colors for the groups, you currently have to make an ODS style change for that. For example, let's assume you are using the "default" style with a bar chart, and I wanted to change your first three groups to red, green, and blue. The following code is the style change necessary:

proc template;
define style styles.berga;
parent=styles.default;
style GraphColors from GraphColors /
"gdata1" = red
"gdata2" = green
"gdata3" = blue
;
end;
run;

You can then specify the "berga" style on your ODS statement to pick up your new colors.

Thanks!
Dan
AndersBergquist
Quartz | Level 8
Thank You for the answer.
I must say, Your paper is very good and I have got several ideas when I reading it.

Back to my problem. Is it enougth to write:

ods style=style.berga; ?

/Anders Message was edited by: Berga
DanH_sas
SAS Super FREQ
Once you submit the little proc template code, you will need to specify the style on you ODS statement. For example, if you're creating HTML output:

ods html file="whatever.html" style=berga;

or if your in the middle of your HTML output using the "default" style, you can change the style in the middle by specifying:

ods html style=berga;
AndersBergquist
Quartz | Level 8
OK,
this is the part I start to be confuse. I use EG and I have no clue which ods output it use.
AndersBergquist
Quartz | Level 8
I found that this will work:
ODS tagsets.sasreport12(ID=EGSR) style=berga;
But I do not no if it is general or just for the project.
AndersBergquist
Quartz | Level 8
There is one more important problem.
When I make a store proces of it, the formatting disapear.

Why not make it possibly to set the colors I need in the code without this powerfull, but in this case unnecessary ODS templates??

/Anders
AndersBergquist
Quartz | Level 8
There is one more problem.
It I use hardcoded colors, such att attribs=(color=red) then if the user change template the color will still be red, but the rest will change.

In this solution, the user can not change template.

/Anders
Cynthia_sas
SAS Super FREQ
Hi:
Generally speaking about stored processes, when you are turning "regular" SAS code into a stored process, your override statements (such as for STYLE or other template) must go BEFORE the %STPBEGIN instruction in the stored process code. So, for example, not only do you have to make sure that the style template and/or the graph template lives on the server environment in a location that is accessible to the stored process server or the workspace server; but, then you also need to issue an ODS PATH statement that points to the correct PATH for templates (on the server, not on your local machine) and then you may need to do something like this:
[pre]
%global _odsdest _odsstyle _odsstylesheet;

%let _odsdest=sasreport12;
%let _odsstyle = berga;
%let _odsstylesheet=;

*ProcessBody;
%stpbegin;
libname srvtemp 'server environ path location for template item store location';

ods path srvtemp.templat(read)
sashelp.tmplmst(read);

...GTL step that uses graph template from above item store...

%stpend;

[/pre]

One warning -- if you are writing stored processes for the SAS Add-in for Microsoft Office or for EG, your style template should be honored assuming it is in the right location and accessible to the stored process. However, if you are writing stored processes for Web Report Studio, there is a possibility that WRS will not respect your style specification. WRS has it's own way of defining styles and may not use the style you set.

This NESUG paper and handout talk about defining and using custom tagset templates in a stored process. The same information would also apply to style templates and graph templates (especially what's in the handout).
Paper: http://support.sas.com/rnd/papers/regional07/paradigm_edu07.zip
Handout: http://support.sas.com/rnd/papers/regional08/SP_Template.pdf

(Note that the information in the paper and handout refer to SAS 9.1.3 -- if you have SAS 9.2 and the Enterprise Intelligence Platform, you may want to work with Tech Support on your template question.)

cynthia
AndersBergquist
Quartz | Level 8
Thank You for the help.
I think I have to call tech-support to get some help. This is to complicted for me.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 9 replies
  • 3263 views
  • 0 likes
  • 3 in conversation