Hello
I want to do plot of 2 vars.
The axis var is numeric with format YYMM.
What is the way to see in x-axis the values: 2201 till 2302
data have;
input YYMM Y :percent8.2;
format y percent8.2;
cards;
2201 0.18%
2202 0.19%
2203 0.22%
2204 0.04%
2205 0.23%
2206 0.27%
2207 0.26%
2208 0.04%
2209 0.06%
2210 0.09%
2211 0.03%
2212 0.04%
2301 0.03%
2302 5.3%
;
Run;
data have2;
set have;
sasdate = input(put(YYMM,4.),yymmn4.);
format sasdate yymmn4.;
Run;
proc gplot data=have2;
plot y*YYMM/
vaxis=0 to 0.1 by 0.01
;
run;
Please look at x-axis. I cannot see the x values well
Well, you have a couple problems - the main one is that you're not using you're newly created variable, SASDATE, in the GPLOT step - instead, you're using the original, unformatted version, YYMM. You also might consider using SGPLOT rather than GPLOT to get more modern-looking graphics. Also, since your data are longitudinal, it will probably be easier to visualize as a line (SERIES) rather than as a scatter plot. Here's an extremely simple version:
proc sgplot data=have2 noautolegend;
series x=sasdate y=Y;
scatter x=sasdate y=Y / markerattrs=(size=5 color=black symbol=circlefilled);
run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.