I would like to set specific three colors as default for all the types of graphs in the Results pane from my EG code (version 8.3).
So far, I have attempted:
1) ODS GOPTIONS (worked for GPLOT and GCHART, but not UNIVARIATE -> HISTOGRAM nor SGPLOT)
2) %MODSTYLE (the same - worked for GPLOT and GCHART, but not UNIVARIATE -> HISTOGRAM nor SGPLOT)
3) PROC TEMPLATE; DEFINE STYLE where I could define new style, but it coudn't be set as default for the Results pane
4) changing HTMLBlue style in Style manager allowed me to specify style in tables very effectively, but not the graphs; in addition it shows a warning message in the log: "WARNING: Style MyStyle not found; HTMLBlue style will be used instead." (which is confusing, as tables are produced with the MyStyle colors)
There are certainly several ways to solve this issue and I would appreciate any. The only solution I have reached so far is putting color attributes within each and every graph, which is definitely suboptimal in the long run.
This is the code to examplify the issue.
Thank you very much in advance!
PROC MEANS DATA=sashelp.electric;
RUN;
ODS GRAPHICS ON;
GOPTIONS COLORS=("#007272" "#F06D00" "#A5E1D2");
PROC GPLOT DATA=sashelp.electric;
PLOT Revenue*Year;
RUN;
PROC GCHART DATA=sashelp.electric (WHERE=(year >= 2000));
VBAR year / DISCRETE SUMVAR=Revenue SUBGROUP=Customer;
RUN;
PROC UNIVARIATE DATA=sashelp.electric NOPRINT;
VAR Revenue;
HISTOGRAM;
RUN;
PROC UNIVARIATE DATA=sashelp.electric NOPRINT;
GOPTIONS COLORS=("#007272" "#F06D00" "#A5E1D2");
VAR Revenue;
HISTOGRAM;
RUN;
PROC SGPLOT DATA=sashelp.electric;
HISTOGRAM Coal;
HISTOGRAM AllPower / TRANSPARENCY=0.6;
RUN;
ODS PATH(prepend) work.templat(update);
%MODSTYLE(NAME=markers, COLORS="#007272" "#A5E1D2" "#F06D00", FILLCOLORS="#007272" "#A5E1D2" "#F06D00", PARENT=statistical, TYPE=CLM);
PROC GPLOT DATA=sashelp.electric;
PLOT Revenue*Year;
RUN;
PROC GCHART DATA=sashelp.electric (WHERE=(year >= 2000));
VBAR year / DISCRETE SUMVAR=Revenue SUBGROUP=Customer;
RUN;
PROC UNIVARIATE DATA=sashelp.electric NOPRINT;
VAR Revenue;
HISTOGRAM;
RUN;
PROC SGPLOT DATA=sashelp.electric;
HISTOGRAM Coal;
HISTOGRAM AllPower / TRANSPARENCY=0.6;
RUN;
My suggestion for this would be to create a DATTRMAP data set to associate properties of graphs with values of group variables.
Then use Proc Sgplot with Histogram statement for historgrams, Vbar (or Hbar) for the bar graph and Series or Scatter instead of gplot.
Personally after fighting with GCHART starting in SAS 6 I would not use that proc unless there was a lot of $$$ reasons involved.
Univariate is more for exploratory purposes. So when appearance and control is important use a procedure like Sgplot or Sgpanel where there are more controls available.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.