BookmarkSubscribeRSS Feed
GraphGuy
Meteorite | Level 14

If you can't find a way to do this with sgplot in your version of SAS (or without using annotate), here's how you could do it in a very straightforward manner with SAS/Graph gplot ...

 

proc format;
value xf
1="very long text long text X very long text long text"
2="long text long text, too X long text long text, too";
run;


data test;
x=1; y=2;
output;
x=2; y=3;
output;
run;


axis1 minor=none order=(2 to 3 by .2);


axis2 split='X' minor=none order=(1 to 2 by 1) offset=(10,10)
label=(justify=center "Will this very long, long, long text split somewhere after here"
           justify=center "and this further text be line 2?");


symbol1 value=circle height=1.5 interpol=join color=blue;


proc gplot data=test;
format x xf.;
plot y*x=1 /
vaxis=axis1 haxis=axis2;
run;

 

split.png

 

In one of the comments, you mentioned wanting to be able to use this with hh mm ss time formatted values(?) I have successfully used the SAS/Graph axis split=' ' option with the spaces in date values (formatted with nldateymm8.), so I think that should work in time values also. Here's the example with split date values:

 

 

lake_wheeler_enterococci_2014.png

 

 

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!

How to Concatenate Values

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.

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
  • 15 replies
  • 4258 views
  • 2 likes
  • 5 in conversation