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

I have SAS Base 9.4.  I have used this code in the past with a different data step and my lollopop chart turned out as expected but this time my hbarparm is not lining up right.  Also, my colors I specified are not showing up.  Does anyone have a solution?

Thanks!

 

Here is the code, attached are the results ...

data data15 ;

input diabet1 risk1 percent1;

cards;

 

1 1 27.5

2 1 74.0

1 2 34.3

2 2 66.5

;

run;

 

/*format percent w/ %*/

Proc format;

value diabet

1="No diabetes"

2="Had diabetes";

value riska

1="High blood pressure"

2="High cholesterol";

run;

 

data demographics;

 

set data15 ;

percent1=percent1/100;

format percent1 PERCENT7.1 risk1 riska. diabet1 diabet.;

run;

 

ods _all_ close;

ods listing gpath="D:\Data";

ods html close;

ods graphics / reset=all outputfmt=emfdual imagename='sastest' width=4.0in height=6.0in noborder;

 

 

proc sgplot data=demographics noborder ;

styleattrs datacontrastcolors=(steelblue steelblue ligr ligr);

hbarparm category=risk1 response=percent1 / group=diabet1 groupdisplay=cluster clusterwidth=0.20

barwidth=0.1 baselineattrs=(thickness=0) ;

scatter y=risk1 x=percent1 / group=diabet1 groupdisplay=cluster

markerattrs=(symbol=circlefilled size=9)

name='percent1' datalabelattrs=(size=6 family="verdana" weight=normal color=black);

xaxis offsetmin=0 display=(noticks noline nolabel novalues)

labelattrs=(size=7 family="verdana" weight=normal )

valueattrs=(size=7 family="verdana" weight=normal );

yaxis display=(nolabel noticks noline) fitpolicy=split

valueattrs=(size=7 family="verdana" weight=normal ) ;

text y=risk1 x=percent1 text=percent1 / group=diabet1 groupdisplay=cluster position=right

textattrs=(size=7 family="verdana" weight=normal color=black);

format risk1 riska. diabet1 diabet. ;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

The clusterwidth=0.2 needs to be on the SCATTER and TEXT statements so that they line up with your HBARPARM.

View solution in original post

1 REPLY 1
DanH_sas
SAS Super FREQ

The clusterwidth=0.2 needs to be on the SCATTER and TEXT statements so that they line up with your HBARPARM.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 549 views
  • 0 likes
  • 2 in conversation