Data visualization with SAS programming

Plot 2 different range values on X axis,

Reply
N/A
Posts: 0

Plot 2 different range values on X axis,

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
SAS Super FREQ
Posts: 862

Re: Plot 2 different range values on X axis,

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]
N/A
Posts: 0

Re: Plot 2 different range values on X axis,

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
Super Contributor
Posts: 291

Re: Plot 2 different range values on X axis,

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 ...
N/A
Posts: 0

Re: Plot 2 different range values on X axis,

Hi Bill,
Thanks for your reply.
Yes, the dummy coding works in some cases. But statistician is not ok with this approach,..

Thanks,...
Regular Contributor
Posts: 165

Re: Plot 2 different range values on X axis,

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.
N/A
Posts: 0

Re: Plot 2 different range values on X axis,

HI RICK M,
Thanks for the info. It is really helpful, and this is what I am looking for,..
Thanks again
Post a Question
Discussion Stats
  • 6 replies
  • 154 views
  • 0 likes
  • 4 in conversation