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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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