BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BobHope
Quartz | Level 8

I have to kind of problems. First of all I still am unable to control the bar outline colors in sgplot (I can do it with DATTRMAP statement but it is not possible to use it in this case). I have tried to find the correct style attribute in the rtf template but still unable to find it so if someone could kindly provide me the correct attribute to modify.

Here is a picture of my problem (I would need the outlines to be black):

rtf_outlines.JPG

Also there is a drastic difference with my rtf and html output. Here are the identical graphs output in different location:

html_counts.JPG

And it would be really critical for me to get the count datalabels to be shown on the RTF also. How I can force this?

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

First Question

The outline is controlled by the "contrast" color, see code example below that shows two techniques using a style and using the new STYLEATTRS statement.

The gdata1 and gcdata1 define the color and contrast color

This works with SAS9.4M2

There might be better ways of doing this.

ods path
  (prepend) work.template (update)
;

proc template;
 
define style styles.mystyle;
    parent=styles.listing;
    style GraphColors from GraphColors /
     
'gdata1'=yellow
     
'gcdata1'=black
     
'gdata2'=green
     
'gcdata2'=green
     
'gdata3'=blue
     
'gcdata3'=blue
    ;
  end;
run;

ods graphicsreset=index;
ods html path="c:\temp" file="sample.html"  style=styles.mystyle;
ods rtf path="c:\temp" file="sample.rtf"  style=styles.mystyle;

proc sgplot data=sashelp.cars ;
  hbar type / group=type datalabel;
run;

proc sgplot data=sashelp.cars  ;
  styleattrs
   
datacolors=(yellow red green)
   
datacontrastcolors=(black red green)
  ;
  hbar type / group=type datalabel;
run;

ods html close;
ods rtf close;

View solution in original post

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

Have a look through this blog: http://blogs.sas.com/content/graphicallyspeaking/

Its an excellent resource for anything graph.

As for your second point, what does the code look like?  Gotta say I have never used HTML as an output destination, but haven't seen any major differences betwee, PDF/RTF etc.

BrunoMueller
SAS Super FREQ

First Question

The outline is controlled by the "contrast" color, see code example below that shows two techniques using a style and using the new STYLEATTRS statement.

The gdata1 and gcdata1 define the color and contrast color

This works with SAS9.4M2

There might be better ways of doing this.

ods path
  (prepend) work.template (update)
;

proc template;
 
define style styles.mystyle;
    parent=styles.listing;
    style GraphColors from GraphColors /
     
'gdata1'=yellow
     
'gcdata1'=black
     
'gdata2'=green
     
'gcdata2'=green
     
'gdata3'=blue
     
'gcdata3'=blue
    ;
  end;
run;

ods graphicsreset=index;
ods html path="c:\temp" file="sample.html"  style=styles.mystyle;
ods rtf path="c:\temp" file="sample.rtf"  style=styles.mystyle;

proc sgplot data=sashelp.cars ;
  hbar type / group=type datalabel;
run;

proc sgplot data=sashelp.cars  ;
  styleattrs
   
datacolors=(yellow red green)
   
datacontrastcolors=(black red green)
  ;
  hbar type / group=type datalabel;
run;

ods html close;
ods rtf close;
BobHope
Quartz | Level 8

Bruno Mullers answer solves the first problem. Thanks. However the problem where the datalabels are missing on the RTF is more severe, and urgently would need to get it fixed. Any help is much appreciated.

BobHope
Quartz | Level 8

Found the solution myself. For some reason Google will always show me 9.3 documentation results only. Now I found the 9.4 documentation which is much broader. The correct option is DATALABELFITPOLICY=NONE

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 4 replies
  • 1256 views
  • 3 likes
  • 3 in conversation