Hello everyone,
I'm trying to create a horizontal bar graph with median and 95% CI using highlow plot, since each bar represents a group I wanted to fill the bars with different patterns keeping the same color. So, I tried doing this by creating a template and by creating data attribute maps and both didnt work for patterns. However, the graph seems to pick the colors from template/attrmap. Is there any way to do this.
SAS version: SAS 9.4_M4
Thanks
Fill patterns for HighLow plot are NOT currently supported. Fill patterns will be supported for most plot types with fill attribute starting with SAS 9.40M5 to be released later this year. In the meantime, you can refer to this recent SASGF 2017 paper by Amos Shu on how you can work around this.
Insufficient information. As a minimum we would need your template, attribut set and actual graph procedure call. Best would also provide an example of the data used for the plots.
You can use Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
Thanks Ballard, for the quick reply. Below is the sample code and attached are plots using template and attribute map. I was expecting to see a pattern "L2" on 2nd and 4th bars.
proc template; define style mypatterns; parent=styles.htmlblue; style graph from graph / attrpriority="None"; style GraphBar from GraphComponent / displayopts = "fill outline fillpattern"; style GraphData1 from GraphData1 / fillpattern = "E"; style GraphData2 from GraphData2 / fillpattern = "L2"; end; run; data attrmap; length fillpattern $4; id='Make'; value='Acura'; fillcolor='Red'; fillpattern='E';output; id='Make'; value='Audi'; fillcolor='Red'; fillpattern='L2';output; id='Make'; value='BMW'; fillcolor='Red'; fillpattern='E';output; id='Make'; value='Buick'; fillcolor='Red'; fillpattern='L2';output; run; proc means data=sashelp.cars; by make; var mpg_city; output out=means mean=mean min=min max=max; where make in ('Acura' 'Audi' 'BMW' 'Buick'); run; options nonumber nodate orientation=landscape; ods graphics /reset noscale width=8in height=5in imagename="Plot using Template"; ods listing gpath="H:\Test" style=mypatterns; title1 " "; footnote1 " "; proc sgplot data=means noautolegend; highlow y=make high=max low=min / type=bar barwidth=0.7 fillattrs=(color=yellow) LINEATTRS=(pattern=solid ) dataskin=crisp group=make; scatter y=make x=mean / markerattrs=(symbol=starfilled size=8 color=black); run; options nonumber nodate orientation=landscape; ods graphics /reset noscale width=8in height=5in imagename="Plot using Attrib Map"; ods listing gpath="H:\Test" style=mypatterns; title1 " "; footnote1 " "; proc sgplot data=means noautolegend dattrmap=attrmap; highlow y=make high=max low=min / type=bar barwidth=0.7 /*fillattrs=(color=yellow)*/ LINEATTRS=(pattern=solid ) dataskin=crisp group=make attrid=Make; scatter y=make x=mean / markerattrs=(symbol=starfilled size=8 color=black); run;
Thanks
Fill patterns for HighLow plot are NOT currently supported. Fill patterns will be supported for most plot types with fill attribute starting with SAS 9.40M5 to be released later this year. In the meantime, you can refer to this recent SASGF 2017 paper by Amos Shu on how you can work around this.
Hi Sanjay,
Thanks for providing the reference. I was able to produce the graph I needed with "barchart" as suggested in the paper.
Thanks
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.