BookmarkSubscribeRSS Feed
Siri29
Calcite | Level 5
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
7 REPLIES 7
DanH_sas
SAS Super FREQ
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
Siri29
Calcite | Level 5
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
DanH_sas
SAS Super FREQ
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
Siri29
Calcite | Level 5
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
DanH_sas
SAS Super FREQ
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
Siri29
Calcite | Level 5
Hey Dan

Its the same problem again...
No background

Siri
Siri29
Calcite | Level 5
Thanks Dan

Appreciate your help.

Siri

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 7 replies
  • 1312 views
  • 0 likes
  • 2 in conversation