Data visualization with SAS programming

Proc SGPanel with bars having a background color

Reply
Occasional Contributor
Posts: 7

Proc SGPanel with bars having a background color

Hello SAS Forum.

Is there any way ,I could set a background color for the bars while using the proc sgpanel.

Here is the sample code for panels(with bars).I want to set a background for bars.
/***************************************************************************************

title1 "Average MPG (City) by Vehicle Origin and Type";

proc sgpanel data = sashelp.cars ;

panelby origin / layout=columnlattice onepanel novarname

noborder colheaderpos=top;

hbar type / response=mpg_city group=type ;

colaxis display=none ;

rowaxis label="Average MPG (City)" ;

keylegend / title="Type" position=right across=1 ;

run;
************************************************************************************/

Any idea on this??

Please let me know..

Appreciate your help.

Thanks

Siri
SAS Super FREQ
Posts: 889

Re: Proc SGPanel with bars having a background color

You can do it by changing the wall color in the style. You can make a little style that inherits from your favorite style but just changes the wall color. Here is a little example:

[pre]
proc template;
define style styles.mybackground;
parent=styles.listing; /* or your favorite style */
style graphwalls from graphwalls /
color=yellow;
end;
run;

ods listing style=mybackground;
[/pre]

Hope this helps,
Dan
Occasional Contributor
Posts: 7

Re: Proc SGPanel with bars having a background color

Thanks Dan for your quick response.

But somehow I couldn't get the background .

this is the way I proceeded:

/**************************************************************


proc template;
define style styles.mybackground;
parent=styles.listing; /* or your favorite style */
style graphwalls from graphwalls /
color=yellow;
end;
run;

ods listing file = "mybackground" ;

title1 "Average MPG (City) by Vehicle Origin and Type";
proc sgpanel data = sashelp.cars description= "mybackground";
panelby origin / layout=columnlattice onepanel novarname

noborder colheaderpos=top ;

hbar type / response=mpg_city group=type ;

colaxis display=none ;

rowaxis label="Average MPG (City)" ;

keylegend / title="Type" position=right across=1 ;

run;

/******************************************************************

Its giving me a warning:

WARNING: Unsupported device 'ACTIVEX' for LISTING destination. Using device 'ACTXIMG'.


I get the output but not with the background for bars.


Thanks again for your help.

Siri
SAS Super FREQ
Posts: 889

Re: Proc SGPanel with bars having a background color

The ODS LISTING statement should read:

ods listing style=mybackground;

Your example had:

ods listing file="mybackground";

Give that a try and see if that works for you.

Thanks!
Dan
Occasional Contributor
Posts: 7

Re: Proc SGPanel with bars having a background color

Thanks Dan

I did change it...

Its giving me output without any errors,but not with the background

here is what i have done.
/************************************************************************


proc template;
define style styles.mybackground;
parent=styles.listing; /* or your favorite style */
style graphwalls from graphwalls /
color=yellow;
end;
run;

ods listing style = mybackground ;

title1 "Average MPG (City) by Vehicle Origin and Type";
proc sgpanel data = sashelp.cars description= "mybackground";
panelby origin / layout=columnlattice onepanel novarname

noborder colheaderpos=top ;

hbar type / response=mpg_city group=type ;

colaxis display=none ;

rowaxis label="Average MPG (City)" ;

keylegend / title="Type" position=right across=1 ;

run;

/***********************************************************************

Am I calling the template correctly in the Panel block?

Thanks

Sri
SAS Super FREQ
Posts: 889

Re: Proc SGPanel with bars having a background color

Hey Siri,

Your code runs correctly for me. Try restarting your SAS session and see if that helps. Your session may be in a state where the style request is getting ignored. Let me know if that works for you.

Thanks!
Dan
Occasional Contributor
Posts: 7

Re: Proc SGPanel with bars having a background color

Hey Dan

Its the same problem again...
No background

Siri
Occasional Contributor
Posts: 7

Re: Proc SGPanel with bars having a background color

Thanks Dan

Appreciate your help.

Siri
Ask a Question
Discussion stats
  • 7 replies
  • 271 views
  • 0 likes
  • 2 in conversation