BookmarkSubscribeRSS Feed
CLE
Obsidian | Level 7 CLE
Obsidian | Level 7

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; 

 

 

1 REPLY 1
Urban_Science
Quartz | Level 8

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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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