Data visualization with SAS programming

Label only the end data point in a series graph

Accepted Solution Solved
Reply
Contributor
Posts: 26
Accepted Solution

Label only the end data point in a series graph

Hello

Is it possible to label only the end point on each series plotted on the y axis.  I have the below and would like only the end point for the previous months and then only the end/most current point labeled on the current month.  Thank you.

PROC TEMPLATE;

DEFINE STATGRAPH LateLoanCt;

begingraph / subpixel=on;

entrytitle 'Total FM Late Loan Units';

layout overlay / xaxisopts=(display=(ticks tickvalues))

yaxisopts=(griddisplay=off display=(ticks tickvalues));

SERIESPLOT X=Pipe_BusinessDayofMonth Y=MTD_Late / LINEATTRS=(COLOR=GREEN PATTERN=SOLID) LEGENDLABEL='MTD' name='a';

SERIESPLOT X=Pipe_BusinessDayofMonth Y=MO1_Late / LINEATTRS=(COLOR=GREY PATTERN=SOLID) LEGENDLABEL="&PREVMOE" name='b';

SERIESPLOT X=Pipe_BusinessDayofMonth Y=MO2_Late / LINEATTRS=(COLOR=BLUE PATTERN=SOLID) LEGENDLABEL="&PREVMOE2" name='c';

SERIESPLOT X=Pipe_BusinessDayofMonth Y=MO3_Late / LINEATTRS=(COLOR=RED PATTERN=SOLID) LEGENDLABEL="&PREVMOE3" name='d';

discretelegend 'a' 'b' 'c' 'd'/ location=outside halign=center valign=bottom;

endlayout;

endgraph;

end;

run;

PROC SGRENDER DATA=WORK.ALLUPLATE1 TEMPLATE=LateLoanCt;

RUN;


Accepted Solutions
Solution
‎04-25-2016 11:36 AM
SAS Super FREQ
Posts: 864

Re: Label only the end data point in a series graph

Here are a couple of ways you could do it:

 

1. For each Y variable, copy the last value of the variable into its own variable (e.g. M01_Late_Last, M02_Late_Last, etc.). Then, use DATALABEL=<your variable> on each SERIES plot to reference each column. That will label only the last point.

2. Seeing that you are using macro variables, you could also stick these values in macro variables and use the CURVELABEL option on each SERIES plot to label the end of the line( e.g. CURVELABEL="&M01_Late_Last").

 

Hope this helps!

Dan

View solution in original post


All Replies
Solution
‎04-25-2016 11:36 AM
SAS Super FREQ
Posts: 864

Re: Label only the end data point in a series graph

Here are a couple of ways you could do it:

 

1. For each Y variable, copy the last value of the variable into its own variable (e.g. M01_Late_Last, M02_Late_Last, etc.). Then, use DATALABEL=<your variable> on each SERIES plot to reference each column. That will label only the last point.

2. Seeing that you are using macro variables, you could also stick these values in macro variables and use the CURVELABEL option on each SERIES plot to label the end of the line( e.g. CURVELABEL="&M01_Late_Last").

 

Hope this helps!

Dan

Contributor
Posts: 26

Re: Label only the end data point in a series graph

Once again thank you very much!!

Post a Question
Discussion Stats
  • 2 replies
  • 240 views
  • 0 likes
  • 2 in conversation