Desktop productivity for business analysts and programmers

Add data label in a gplot

Reply
Contributor CLE
Contributor
Posts: 21

Add data label in a gplot

I'm trying to add data labels to one of my plotted lines against the y axis (I have two y axis bars). All it does is put a little dot where it is supposed to be putting the value of char_var from the AMT_VAC_SUMMARY data set. Count_of_EMPL_IND is a numeric variable and I'm attempting to use the put line to rename it and change it to a character value.  Any help is appreciated. I've spend 8+ hours trying to teach myself how to do this function! 

 

Main data table: AMT_VAC_SUMMARY

 

Current code: 

%annomac;
data AMT_VAC_SUMMARY2;
length funciton style color $8 text $50;
set AMT_VAC_SUMMARY;
%annomac;
%system(2,2);
char_var=put(Count_of_EMPL_IND,3.);
if Count_of_AOD_EMPL_IND>=0 then do;
%label (Cal_Month,Count_of_AOD_EMPL_IND,char_var,orange,0,0,3,zapf,2);
end; 

 

 

Occasional Contributor
Posts: 8

Re: Add data label in a gplot

CLE,

While this does not answer your question about gplot, have you considered using sgplot instead?  if your goal is to label a series, sgplot does not require an annotation dataset to label points on a graph.  Here is a link to the sgplot's documentation for more infomation about sgplot.

 

Here is a quick example of how to graph two lines on both y-axis and label one of them using sgplot.

proc sgplot data=sashelp.cars (where=(make="Audi"));
	vline  EngineSize / response = Horsepower 
		datalabel= Horsepower;
	vline EngineSize / response=MPG_Highway
		y2axis;
run;
Ask a Question
Discussion stats
  • 1 reply
  • 315 views
  • 0 likes
  • 2 in conversation