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

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 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

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

Browse our catalog!

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