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

I need to plot a horizontal bar chart and will like to make certain labels bold, also with borders and background colors.

I have being struggling with this issue for a while please I need urgent help .

I have included a sample of my program for any one who wish to help

 

ods listing style=listing;
ods graphics/ width= 10in height=10.81in ;
goptions  gunit=pct rotate=landscape ftext= "Arial";
goptions htext=13pt htitle=15pt gsfname=cgrt1;
ods graphics on / reset=index imagename="test1";

data anno;
 length label $25;
set test.exports; retain function 'text' xsys 'datavalue' width 80 textweight 'bold' border 'true' linecolor 'lightblue' fillcolor 'lightblue' ; yc1=melde_grup ; label=melde_grup; if grup in ("Cars") then x1=-10; if grup in ("Electronics") then x1=8; if grup in ("Utensils") then x1=11; run;
title "my exports"; proc sgplot data=test.exports sganno=anno pad=(bottom=5%); styleattrs datacolors=(gray green); yaxis grid type=discrete discreteorder=data; hbar type /response=reported group=area groupdisplay=cluster barwidth=0.8 missing ; yaxis display=(nolabel) offsetmin=0.05 offsetmax=0.05; xaxis label='exports in %' grid offsetmin=0.0 offsetmax=0.05; keylegend / location=outside position=bottomleft across=1 title="" exclude=(" "); run;
orderTypereportedareagrup
1Cars   
2Pegueot100your_companyCars
3Fiat84,1your_companyCars
4Nissan92,6your_companyCars
5Electronics your_company 
6TV15,2your_companyElectronics
7Radio15,2your_companyElectronics
8Iron15,2your_companyElectronics
9Tablett15,2your_companyElectronics
10Utensils your_company 
11Frying pan70your_companyUtensils
12Cutleries your_companyUtensils
13Plates12,8your_companyUtensils
14Knives your_companyUtensils
15Pots50,4your_companyUtensils
1Cars   
2Pegueot88,3regionCars
3Fiat88,3regionCars
4Nissan regionCars
5Electronics99,6region 
6TV84,7regionElectronics
7Radio73,4regionElectronics
8Iron70,2regionElectronics
9Tablett70,6regionElectronics
10Utensils84,8region 
11Frying pan regionUtensils
12Cutleries69,1regionUtensils
13Plates68,1regionUtensils
14Knives68,1regionUtensils
15Pots51,7regionUtensils

 

I want the cars , electronics and Utensils to be bold with borders and background color as in data anno. This is not working fine. I will appreciate any help

1 ACCEPTED SOLUTION
4 REPLIES 4
Jay54
Meteorite | Level 14

This seems similar in nature to the Forest Plot example in this blog article.  You can do some of this using the AxisTable with SAS 9.4 or later.  Backgrounds may require some other solution.

Anita_n
Pyrite | Level 9

Thanks I will try that to see if it works

Anita_n
Pyrite | Level 9

Thanks a lot Sanjay for your support. When I use the yaxistable in sgplot, it displays the whole group as table on the yaxis.

That is not what I really want. When  I use sganno it works but if I apply the same syntax for another procedure with different variable it doesn't . I don't really understand that because every is the same only the variable change.

 

Anyway if am able to solve that I will leave a post.

Thanks

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 24656 views
  • 1 like
  • 2 in conversation