BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
podarum
Quartz | Level 8

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

1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

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

8 REPLIES 8
Cynthia_sas
Diamond | Level 26

Hi:

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

cynthia

podarum
Quartz | Level 8

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

Jay54
Meteorite | Level 14

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);

podarum
Quartz | Level 8

Thanks Sanjay.. works fine..

podarum
Quartz | Level 8

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

Jay54
Meteorite | Level 14


See my recent article on this topic at Graphically Speaking

podarum
Quartz | Level 8

Great stuff.. Thank you.

podarum
Quartz | Level 8

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,


hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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