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;
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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.