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
SAS Super FREQ

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,


sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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