SGPLOT HBAR with groups outline problem

Accepted Solution Solved
Reply
Contributor
Posts: 59
Accepted Solution

SGPLOT HBAR with groups outline problem

I have hard times with proc sgplot hbar statement and its outlines when there are groups involved. I would need the outline borders to be black for every group (now it somehow makes the border with darker group color). I have tried to use outlineattrs=(color=black) with no effect, also tried to use dattrmap dataset with outlinecolor variable with no effect (couldn't find a list about valid dattrmap variable names so just guessed the outlinecolor). Also I have tried to change the template used (output is in rtf so I have modified the styles.rtf parents) with the following modifications:

class GraphOutlines /

linethickness=1px

linestyle=1

contrastcolor=black (or CX000000)

color=black (or CX000000);

I have attached the code used to generate the graph.

PS. I have SAS 9.4

edit: data color; length fillcolor $15.; input value $ fillcolor $ ID $ outlinecolor $; datalines; Group2 lightblue barchart black Group1 red barchart black Group3 orange barchart black Group4 green barchart black ; run; data data; input group $ vars $ count; datalines; Group1 var1 26 Group2 var2 15 Group3 var2 1 Group2 var3 4 Group1 var3 4 Group2 var4 3 Group3 var4 1 Group2 var5 2 Group1 var6 1 Group2 var7 1 Group1 var8 1 Group2 var9 1 Group1 var10 1 Group1 var11 1 Group1 var12 1 Group1 var13 1 ; run; ods graphics on /border=no height=17cm width=9in imagemap=on outputfmt=png; proc sgplot data=data nosubpixel des="" dattrmap=color; hbar vars/group=group response=count attrid=barchart datalabel barwidth=1 outlineattrs=(color=black); run;

Attachment

Accepted Solutions
Solution
‎08-11-2014 12:39 PM
Super User
Posts: 10,516

Re: SGPLOT HBAR with groups outline problem

See what happens if you change the outlinecolor variable to linecolor in the color dataset.

View solution in original post


All Replies
Super User
Posts: 10,516

Re: SGPLOT HBAR with groups outline problem

Need some data that recreates the problem, and the dattrmap data.

Also with a program as short as yours it is easier on us to just post the code in the post instead of an attached file.

I think you have a problem with an extra ; after the outlineattrs and in the online help for SAS 9.3 I don't see outlineattrs as an option for hbar. It does appear as an option for barchart and barchartparm for GTL and sgrender though.

Contributor
Posts: 59

Re: SGPLOT HBAR with groups outline problem

I have now updated my first post to contain all the neccessary data/code to replicate my problem. The reason I did have to attach the code the first time (instead of copy paste) was that copy paste just does not work in this editor text box (at least on my browser). Now I could paste it on the edit box but it can't handle new lines etc.

And for more information I am using SAS through server if this is critical information to solve this issue.

Thanks.

Super User
Posts: 10,516

Re: SGPLOT HBAR with groups outline problem

SAS chose to use this forum software that is incompatible with the enhanced editor. The work around is to copy from the SAS editor and paste into a pure text editor such as NOTEPAD, then copy and paste here. The enhanced editor apparently uses some form of HTML but not compatible when pasted.

Solution
‎08-11-2014 12:39 PM
Super User
Posts: 10,516

Re: SGPLOT HBAR with groups outline problem

See what happens if you change the outlinecolor variable to linecolor in the color dataset.

Contributor
Posts: 59

Re: SGPLOT HBAR with groups outline problem

Thanks a lot! This solved my problem. I tip you with a virtual beer.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 250 views
  • 0 likes
  • 2 in conversation