Data visualization with SAS programming

gplot order and dates

Not applicable
Posts: 0

gplot order and dates

I have dates in the following format monyy (eg JAN06, FEB06, etc).
How do I plot dates from JAN09 to FEB10 by quarter?
Thank you.
Super Contributor
Super Contributor
Posts: 3,176

Re: gplot order and dates

Posted in reply to deleted_user
Share a sample of your SAS data set that you want to plot/chart. And you will want your SAS variables to be NUMERIC, DATE variables, not tranformed character-string representations of a mmmyy flavor.

For SAS 9.2, consider XAXIS and INTERVAL= option. Or option to derive a quarter-start date variable and use the SAS output FORMAT to display as needed.

Scott Barry
SBBWorks, Inc.
Valued Guide
Posts: 765

Re: gplot order and dates

Posted in reply to deleted_user
hi ... the following makes a data set with 1000 dates then does a histogram
of the dates grouped by year-quarter

I made the assumption that when you said PLOT you meant CHART since
I'm not quite sure how a PLOT fits with grouping data on the X-AXIS

so, here's a suggestion
* make some fake data;
data x;
do j=1 to 1000;
dt = ceil(750*ranuni(123)) + 15000;
format dt monyy.;
drop j;

* look at the data ... table of MONTH-YEAR;
proc freq data=x;
table dt;

* histogram ... dates grouped by quarter within year using YYQ. format;
proc gchart data=x;
vbar dt / discrete;
format dt yyq.;
Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation