BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I previously posted this question on the Procedures forum, but I think maybe it actually belongs here since this is being done in EG.

Is it possible in PROC GPLOT to plot dates along the x-axis as categorical variables instead of time-series?

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.

If I use the bar-line chart and specify to use "one bar for each unique data value" it will plot like mentioned above, but I need to be able to plot multiple lines like this. I've got to believe this is possible in SAS, maybe here I would need to convert the dates to text???

Thanks for any help,
Brad
2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12
To convert a date data type to a character variable that has 'sortable' characteristics, use one of the year-month-day types, like

PUT(MyDateVar, yymmdd10.)

in the expression builder to create a text version on the original date.

Presenting a naturally scaled variable as ordinal may distort the relationship in the variables. Caveat emptor.
deleted_user
Not applicable
That works for what I'm trying to do. Thanks.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1129 views
  • 0 likes
  • 2 in conversation