BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi-,
I am trying to create a PK graph. The time values on X axis are 2,4,6.5,9,200,250,400,600,690,710 weeks.

I would like to present 2 to 9 weeks first on the x-axis then break the X-axis and present remaining 200 to 710 weeks on X-axis. Otherwise, 2 to 9 weeks were displayed so close they almost appear as one data point on X-axis. For this reason i would like to present them as 2 different ranges (2-9 and 200 and 710).

Please note that i want to preserve the distance between 2 data points on x-axis meaning the distance between data point 2 and 4 should be less than distance between .4 and 6.5, similarly distance between 600 and 690 should be more than distance between 690 and 710. I do not want to present these with same distance between them,...

Please let me know if you know how to do it,...

Thanks

Thanks
6 REPLIES 6
DanH_sas
SAS Super FREQ
If you have SAS 9.2, you can use ODS Graphics to do it. Basically, the two range are put into two cells of a lattice. the axis values are naturally placed in their location in linear space. I'm not sure of the appearance details you want, so just try this example and ask me any questions you have about it.

Thanks!
Dan

[pre]
data smalldata;
input x1 y1;
cards;
2 200
4 400
6.5 650
9 900
;
run;

data bigdata;
input x2 y2;
cards;
200 200
250 250
400 400
600 600
690 690
710 710
;
run;

data realdata;
merge smalldata bigdata;
run;

proc template;
define statgraph broken;
dynamic list1 list2;
begingraph;
layout lattice / columns=2 columngutter=3;
layout overlay / walldisplay=(fill) xaxisopts=(linearopts=(tickvaluelist=list1));
scatterplot x=x1 y=y1;
endlayout;
layout overlay / walldisplay=(fill) yaxisopts=(display=none)
xaxisopts=(linearopts=(tickvaluelist=list2));
scatterplot x=x2 y=y2;
endlayout;
endlayout;
endgraph;
end;
run;

proc sgrender data=realdata template=broken;
dynamic list1="2 4 6.5 9" list2="200 250 400 600 690 710";
run;
[/pre]
deleted_user
Not applicable
Hi Dan,
Thank you very much for you reply.
Unfortunately I am using sas 9.1 and I did not find any solution for this in 9.1.

Please let me know if you think otherwise,..

Thanks
Bill
Quartz | Level 8
perhaps you could use "dummy" values for the axis to force the distances and then use the tick mark options to label the tick marks with the desired values ...
deleted_user
Not applicable
Hi Bill,
Thanks for your reply.
Yes, the dummy coding works in some cases. But statistician is not ok with this approach,..

Thanks,...
RickM
Fluorite | Level 6
There is a graph example on support.sas.com "Sample 24909: Create a 'break' on the vertical axis of a plot" that might be helpful to you.
deleted_user
Not applicable
HI RICK M,
Thanks for the info. It is really helpful, and this is what I am looking for,..
Thanks again

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
  • 6 replies
  • 1029 views
  • 0 likes
  • 4 in conversation