Data visualization with SAS programming

Proc gplot - Adjusting axis to see outliers

Reply
Contributor
Posts: 20

Proc gplot - Adjusting axis to see outliers


Hi,

x-axis order = (0 to 56 by 7) and y axis order=(0 to 120 by 10). I am displaying box using proc gplot. My graph have two outliers 44,40. but they are not visible.  when I change y - axis order to ( 0 to 63 by 7) then I was able to see the outliers. But I have to keep the y aixs order to ( 0 to 56 by 7) , then how do I get outliers visible in my graph. any help would be greatly appreciable.

Super User
Posts: 11,134

Re: Proc gplot - Adjusting axis to see outliers

Code example would be helpful including any AXIS or SYMBOL statements.

PROC Star
Posts: 1,293

Re: Proc gplot - Adjusting axis to see outliers

Hi,

One of my pet peeves with GPLOT is that it happily excludes data that is outside of the axis range, with only a mere note that data have been excluded from the plot. So:

data a;
  input x y;
  cards;
1 50
2 150
3 50
4 150
;
run;

symbol i=join;
axis1 order=(0 to 100 by 25);

proc gplot data=a;
  plot y*x/vaxis=axis1;
run;

Returns a straight horizontal line, with only the log notes to indicate something went wrog: line.

158  proc gplot data=a;
159    plot y*x/vaxis=axis1;
160  run;

NOTE: 2 observation(s) outside the axis range for the y * x request.

Seems odd to me that SAS will happily adjust title size, axis labels, etc, automatically, but won't adjust the axis range if you've defined one that is too small.  I don't know of a nice solution, other than to specify an axis range which includes all of your data.

--Q.

Contributor
Posts: 20

Re: Proc gplot - Adjusting axis to see outliers

Here is the code which am using..

Any help would be greatly appreciated..

goptions vsize=16cm hsize=24cm htext=1 device=gif;

options orientation=landscape;

axis1 order=(0 to 56 by 7);

axis2 order=(0 to 120 y 10);

symbol1 value=star i=boxjt mode=include color=blue  l=1;

symbol2 value=circle i=boxjt mode=include color=black l=2;

symbol3 value=triangle i=boxjt mode=include color=red l=3;

proc gplot data=xxxx;

  plot result*day=drugcode/haxis=axis1 vaxis=axis2;

run;quit;

PROC Star
Posts: 1,293

Re: Proc gplot - Adjusting axis to see outliers

I think you will need to adjust your axis statement to accomodate the outliers.

You can do this dynamically by reading in the dataset before you run the GPLOT step, and finding the min and max value seen in the data.  Then pick a by value that makes sense, and write the min, max and by values  to macro variables to be used in your axis statement.

HTH,

--Q.

Super User
Posts: 11,134

Re: Proc gplot - Adjusting axis to see outliers

A_B_C wrote:

axis1 order=(0 to 56 by 7);
proc gplot data=xxxx;

  plot result*day=drugcode/haxis=axis1 vaxis=axis2;

run;quit;

From online help on the INTERPOL=BOX section of the SYMBOL statement:

Note:   If you use the HAXIS= or VAXIS= options in the PLOT statement or the ORDER= option in an AXIS definition to restrict the range of axis values, by default any observations that fall outside the axis range are excluded from the interpolation calculation.

Since you obviously have data outside of the desired axis you are not going to get it to display. You may need to provide a foot note that data exists outside of the display range.

Ask a Question
Discussion stats
  • 5 replies
  • 1230 views
  • 0 likes
  • 3 in conversation