Good day to all.
I'm newbie in SAS.
I need labeling each fourth dot like this: " was built in &year_of_release ".
&year - is a variable value that store in data set. My table has three values: year, year_of_release and freq.
Year (simple number like 2014) and freq3 (number like 0.00514554) are used in graph as X and Y.
Year_of_release (simple number like 2014) is used in graph as value for grouping.
There is my code (you can see that I tried to use a "pointlabel" option but it doesn't display an information that I need, it always show a "freq3" information for some reason):
%macro prognostic_graph;
goptions reset=all device=activex ypixels=600 xpixels=800;
;
symbol1
INTERPOL = join
VALUE = dot
LINE = 1
WIDTH = 1
HEIGHT = 0.7
POINTLABEL = ("#year_of_release");
;
Axis1
STYLE = 0
WIDTH = 0
LABEL = (font="Arial/bold" a=90 Justify=center "Freq ")
VALUE = (font="Arial" HEIGHT=9pt )
MINOR = none
ORDER = (0 to 0.02 by 0.001)
OFFSET = (0,0)
;
Axis2
ORDER = (2002 to 2018 by 1)
STYLE = 0
WIDTH = 0
LABEL = (font="Arial/bold" Justify=center "Years")
VALUE = (font="Arial" HEIGHT=9pt )
COLOR = cx&gridColor
MINOR = none
OFFSET = (0,0)
;
PROC GPLOT DATA=mergeDots;
PLOT freq3 * year = year_of_release /
VAXIS = AXIS1
HAXIS = AXIS2
NOFRAME
GRID
NOLEGEND
;
RUN;
%mend prognostic_graph;
Thank you for your attention.
Try using device=png rather than device=activex.
The SAS/Graph device=activex implementation does not support all the customization features (such as pointlabel) fully.
TBH I would strongly suggest moving away from GPLOT to SGPLOT at minimum or preferably proc template/GTL. You will have far more control over outputs. Have a look at this blog which has hundreds of examples of graphs with most options you could ever need, with example code generally in sgplot and GTL.
Thank you for your recomendation! I will be work with SGPLOT next time.
Try using device=png rather than device=activex.
The SAS/Graph device=activex implementation does not support all the customization features (such as pointlabel) fully.
Thank you, your comment decided my problem!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.