BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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.
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.

http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/xaxis-stmt.htm



Scott Barry
SBBWorks, Inc.
MikeZdeb
Rhodochrosite | Level 12
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
[pre]
* make some fake data;
data x;
do j=1 to 1000;
dt = ceil(750*ranuni(123)) + 15000;
output;
end;
format dt monyy.;
drop j;
run;

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

* histogram ... dates grouped by quarter within year using YYQ. format;
proc gchart data=x;
vbar dt / discrete;
format dt yyq.;
run;
quit;
[/pre]

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1473 views
  • 0 likes
  • 3 in conversation