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 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!

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
  • 792 views
  • 3 likes
  • 2 in conversation