BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
walkerel
Calcite | Level 5
TITLE1 "Hypertension-Related Death Rates by State";
PROC SGPLOT DATA = HypRslt.StatePercents;
		VBAR StateCd / Group = ColPercent
							  GROUPDISPLAY=cluster
							  DATALABEL = ColPercent
							  ;
							  
		
	REFLINE 1.8
		/ AXIS = Y
		  LABELLOC = inside
		  LINEATTRS=(COLOR = INDIGO
		  			 PATTERN = SHORTDASH)
		  LABEL = 'National Average = 1.8';
		  
	XAXIS LABEL = 'State Code'
		  LABELATTRS= (WEIGHT = BOLD)
		  ;
		  
	STYLEATTRS DATACOLORS= (LIGHTSALMON)
			   DATACONTRASTCOLORS= (BLACK);
			   
	YAXIS LABEL = 'PERCENT'
		  OFFSETMIN= 0
		  LABELATTRS= (WEIGHT = BOLD)
		  VALUES = (0,1,2,3,4)
		  GRID;

Hi all,

 

When I submit the code above, SAS is generating a flat bar graph like Graph 1 attached below. What code do I need to fix to get SAS to produce a graph like Graph 2 attached below? (All of the data used are fictitious data that were created for the sole purpose of illustrating a concept). Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Jagadishkatam
Amethyst | Level 16

Please try the below code, replace the group= with response and it should generate the expected output

 

PROC SGPLOT DATA = HypRslt.StatePercents;
		VBAR StateCd / response= ColPercent
							  GROUPDISPLAY=cluster
							  DATALABEL = ColPercent;
run;
quit;

 

 

Thanks,
Jag

View solution in original post

1 REPLY 1
Jagadishkatam
Amethyst | Level 16

Please try the below code, replace the group= with response and it should generate the expected output

 

PROC SGPLOT DATA = HypRslt.StatePercents;
		VBAR StateCd / response= ColPercent
							  GROUPDISPLAY=cluster
							  DATALABEL = ColPercent;
run;
quit;

 

 

Thanks,
Jag

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 965 views
  • 3 likes
  • 2 in conversation