Hello,
I have a problem in date axis in proc gplot. If I do nothing, the time axis is '1985/01 ... 1990/01.....1995/01....2000/01....2005/01.....2010/01.....2015/01'.
The ideal time axis I want to get is '1988/08 .......1992/12 or 1992/08...............2014/12' OR '1988 ....only year ....... 2014'
What should I add in the option 'axis'? I try to use 'order()' in the axis, but it does not work well. How to make the time axis look better?
The data is as follow:
date Cum_Ret
1988/08 xxx
1988/09 xxx
.... ...
...
2014/12 xxxx
Thanks!
please try to read the date using the yymmn6. informat in the datastep. this will convert the date to numeric values. then sort the data on this numeric value and when you use the date in proc gplot apply the format yymms10. This will display the date as expected.
when you try to use the informat, try the below statement date2=input(compress(date,'/'),yymmn6.);
Thanks,
Jag
Hi. Give this a try ...
data x;
input date :anydtdte. cum_ret;
format dt yymon.;
datalines;
1988/08 100
1988/09 200
1995/11 300
2005/07 220
2014/12 150
;
goptions reset=all gunits=pct;
axis1 order=0 to 350 by 50 label=(a=90);
axis2 minor=none;
symbol1 f='wingdings' v='6c'x h=2;
proc gplot data=x;
plot cum_ret*date / noframe vaxis=axis1 haxis=axis2;
format date year.;
run;
quit;
I would say that two endpoints don't really describe a desired axis very well. Do you want annual, month, quarterly or some other interval to appear on the axis? And is your date variable a SAS date or not?
Some of the issue is that your are apparently trying to display 26 years of data.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.