BookmarkSubscribeRSS Feed
AmitKB
Fluorite | Level 6
Hi all,
I tried to use the datalabel option to display values for vbar in proc sgplot. It gives syntax error.

Does datalabel option not work. What is a workaroud to display values.

Regards,

Amit
4 REPLIES 4
DanH_sas
SAS Super FREQ
DATALABEL support for bar charts was not added until 9.2 phase 2. Do you have 9.2 phase 1 or phase 2?
DanH_sas
SAS Super FREQ
As a workaround, you could use GTL with a bar/scatter overlay. The code below will produce a bar chart like you would see from SGPLOT with the labels added:

proc template;
define statgraph barlabel;
begingraph;
layout overlay;
barchartparm x=age y=height;
scatterplot x=age y=eval(height+5) / markercharacter=height;
endlayout;
endgraph;
end;
run;

proc summary data=sashelp.class noprint nway;
class age;
var height;
output out=barsum sum=;
run;

proc sgrender data=barsum template=barlabel; run;
AmitKB
Fluorite | Level 6
Hi Dan,
My SAS version is : SAS 9.2 TS Level2MO. The workaround worked.

I appreciate all your help.

Regards,

Amit
DanH_sas
SAS Super FREQ
TS2 is phase 2, so DATALABEL on the bar chart should be available to you. Does the following code run for you?

proc sgplot data=sashelp.class;
vbar age / response=height stat=mean datalabel;
run;

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
  • 4 replies
  • 2898 views
  • 2 likes
  • 2 in conversation