Help using Base SAS procedures

Categorical Date Variables in Line Plot

Reply
N/A
Posts: 0

Categorical Date Variables in Line Plot

Is it possible in PROC GPLOT to plot dates along the x-axis as categorical variables instead of time-series? By doing this I would want dates that are 1 week, 1 month, or 1 year apart from each other to be plotted next to each other with the same amount of spacing between them.

I am doing this in SAS Enterprise Guide 4.1.

Thanks,
Brad
Valued Guide
Posts: 2,177

Re: Categorical Date Variables in Line Plot

Posted in reply to deleted_user
I recall defining axis or midpoints with [pre] "01jan2006"d to "01jan2008"d by month [/pre] which produces an unimportant message that the intervals are not equal.

Would something like that help ?

PeterC
N/A
Posts: 0

Re: Categorical Date Variables in Line Plot

Posted in reply to deleted_user
Thanks for the reply Peter,
I tried this and all I get is the same output as before, only now it only goes from Jan '06 to Jan '08.

My problem is that if I have 10 datapoints total that are being plotted and 6 points are in january '06 and my next 4 datapoints are in November '08 I'm getting a long straight line from the last datapoint in January until my first data point in November. I would like for this to plot the 10 points equidistant from each other instead of putting the time gap in between them (not sure if this is possible).
Super Contributor
Super Contributor
Posts: 3,174

Re: Categorical Date Variables in Line Plot

Posted in reply to deleted_user
Another option is to code your axis datapoints explicitly, noting that you can code them as a date literal, as well as stated previously with a date-range. Obviously, choosing the values to plot on the axis will be based on your own data and some calculated decision for your axis requirements.

Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: Categorical Date Variables in Line Plot

Posted in reply to deleted_user
Is there a way to code this dynamically so the dates to plot would change each time the process is run? I wont really know the exact dates that are going to need to be plotted, and there could be hundreds of them.
Thanks
Super Contributor
Super Contributor
Posts: 3,174

Re: Categorical Date Variables in Line Plot

Posted in reply to deleted_user
Not really and it depends. The "dynamic" part would need to be your own thought / code process based on the input data to be charted, as you have conveyed. And you would need to generate explicit (or range-of) values to plot on a given axis. Most likely that would be DATA step code and SAS statements to generate SAS code dynamically which you would then invoke.

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 5 replies
  • 151 views
  • 0 likes
  • 3 in conversation