Help using Base SAS procedures

X-Axis on SGPLOTS

Accepted Solution Solved
Reply
Super Contributor
Posts: 395
Accepted Solution

X-Axis on SGPLOTS

Hi,  I'm running SGPLOTS and although the x-asix is the correct one, it doesn't show up as expected...

My code is

proc sgplot data = Data;

vline  Date / response = NHPI y2axis;

xaxis values=('01Jan2010'd to '31Dec11'd by qtr);

xaxis Label = 'Date' Grid Values = (0 to 5 by 1);

refline '31Dec11'd / axis=x;

run;

But the X-Axis still shows up crammed and not readable (from the Jan2000 to Dec2011, rather then the time span specified)... any ideas?  Thanks


Accepted Solutions
Solution
‎04-07-2012 11:15 AM
SAS Super FREQ
Posts: 1,104

Re: X-Axis on SGPLOTS

Add TYPE=time on the first xaxis stmt and remove the second xaxis stmt.

  xaxis type=time values=('01Jan2010'd to '31Dec11'd by qtr);

View solution in original post


All Replies
SAS Super FREQ
Posts: 8,742

Re: X-Axis on SGPLOTS

Hi:

Is it an accident that you have 2 XAXIS statements in your code? Each XAXIS statement has a VALUES= option.

cynthia

Super Contributor
Posts: 395

Re: X-Axis on SGPLOTS

Thanks Cynthia,  I removed the second xaxis line and got the same results..

Solution
‎04-07-2012 11:15 AM
SAS Super FREQ
Posts: 1,104

Re: X-Axis on SGPLOTS

Add TYPE=time on the first xaxis stmt and remove the second xaxis stmt.

  xaxis type=time values=('01Jan2010'd to '31Dec11'd by qtr);

Super Contributor
Posts: 395

Re: X-Axis on SGPLOTS

Thanks Sanjay.. works fine..

Super Contributor
Posts: 395

Re: X-Axis on SGPLOTS

What line could I add if I wanted to show another variable as a secondary Y-Axis but on a different scale.. so have a left and right scale for each of the 2 vars?  Thanks

SAS Super FREQ
Posts: 1,104

Re: X-Axis on SGPLOTS


See my recent article on this topic at Graphically Speaking

Super Contributor
Posts: 395

Re: X-Axis on SGPLOTS

Great stuff.. Thank you.

Super Contributor
Posts: 395

Re: X-Axis on SGPLOTS

Hey, what's the best way to show a correlation between Price and say Unemployement rate on a graph?  I'm thinking a 2-Y axis chart?

Thanks,


☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 381 views
  • 0 likes
  • 3 in conversation