Data visualization with SAS programming

Q: How to: Vbar left Y-axis and plot/interpol=join right Y-axis?

Super Contributor
Posts: 339

Q: How to: Vbar left Y-axis and plot/interpol=join right Y-axis?


I find myself with datapoints by timeslices. 18 data points per day as for the business hour (6-24) for a call center. Leaving appearances options and axis statements out (for the Y-axis) not to break the statistic act, here is more or less what my original approach is

symbol1 interpol=join;
options nobyline;

title "something #BYVAL";

legend1 position=(bottom center outside) down=3;

legend2 position=(bottom center outside) down=1;

/*axis1 ...*/

/*axis2 ...*/

axis3 label=("Time") order=("6:00"t to "24:00"t by hour) minor=(number=1) value=(angle=90);

proc gplot data=temp;

     by date;

     label busyhours="Time spent answering calls"

               notreadyhours="Time spent on breaks"

               logonhours="Time spent idle";

     plot (busyhours notreadyhours logonhours)*time / haxis=axis3 vaxis=axis1 overlay areas=3 legend=legend1;

     plot2 droppedcalls*time / vaxis=axis2 legend=legend2;



Now the above is faulty as it give the representation as though my data was continuous (or almost) where in reality they're hourly aggregates. I simply want to create the alternative output in case the clients need visual explanation of this.

Originally, I was using device=java or device=activex with html output and the object functionalities would allow me to dynamically change one of the graphs from an interpol=join to an interpol=step and it would suffice to depict the concept (it kills the last data point). However, constraints on the client side are such that I can't provide the .JAR or activex .exe and after falling back to PDF output, I find myself unable to reproduce that vbar like effect of interpol=step. In particular, when I change interpol=join to interpol=step in the above for PDF output, I lose the overlay+areas filling effect and a bunch of lines at different height is really awful to seize the information in the graph.

So onwards to the question, which is pretty much the thread title:

How could I achieve, within the same graph, a vbar setup where 3 data values pile up for each data point and have a join curve of a closely related but completely different variable on the right axis.

P.S. I am not keen to using annotate facility as I am unfamiliar with it and the by variable produces 90 graphics (one per day) and it seems like a tedious job to learn annotate with.



Super Contributor
Posts: 339

Re: Q: How to: Vbar left Y-axis and plot/interpol=join right Y-axis?

Posted in reply to Vince28_Statcan

I feel somewhat like an idiot for not having thought of PROC GBARLINE before. However, if anyone reads this and knows a way to have interpol=step work with overlay/areas to achieve the intended output, that would be really appreciated.


Ask a Question
Discussion stats
  • 1 reply
  • 1 in conversation