Data visualization with SAS programming

Numbers gplot creates with symbol interpol=box25 mode=include

Reply
Occasional Contributor
Posts: 5

Numbers gplot creates with symbol interpol=box25 mode=include

I am trying to make it easy for the person doing quality control on my graph. I have the following gplot statement:


symbol1 interpol=BOX25 color=black width=1 bwidth=4 mode=include;

proc gplot data=comb1 gout=work.heartih ;
plot hr * grp / anno=anno name='route'
haxis=axis1
vaxis=axis2 ;
ods output route=temp;
run;


As a result, SAS is creating the Q1, Q3 and Median values within the statement like a black box. I would like to be able to pump those values out to some external dataset so that someone could verify that what gplot is doing is actually what is expected. This would be a much more accurate way of checking that using the eyeball on the printed graph. Any help would be appreciated. Thanks
SAS Employee
Posts: 980

Re: Numbers gplot creates with symbol interpol=box25 mode=include

If knowing the exact numbers used in the boxplot is important, you might want to try "proc boxplot" (part of SAS/STAT, rather than SAS/GRAPH) - it has an "outbox=" option that will let you create a data set containing the actual numbers.

http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/statug_boxplot_sect015.htm
Occasional Contributor
Posts: 5

Re: Numbers gplot creates with symbol interpol=box25 mode=include

Yes, I could do that, but I'm sort of back to where I started (having a different proc to give me numbers for QC). I didn't use proc boxplot to begin with because I couldn't see how to get rid of the 'whiskers'. My spec calls for a box plot showing the range (box) between Q1 and Q3 with the median. Hence I went with gplot and the box25 in the symbol statement. Is there a way to get this with boxplot? Thanks
SAS Employee
Posts: 980

Re: Numbers gplot creates with symbol interpol=box25 mode=include

Hmm ... I see 2 other alternatives (there might be other alternatives using GTL or sgplot, etc, that I don't know about).

1 - Use proc boxplot (or other sas analytics procs) to generate a data set containing the values describing the boxplot, and then use annotate to actually draw the boxplot geometry onto an empty gplot set of axes. This would take a bit of work, but it *could* be done this way (I've done something similar in a special dashboard before).

2 - Use dev=activex to draw the SAS/GRAPH gplot bar chart, and then have your QA person view the graph in a browser, and hover their mouse over the boxes to see the actual box values. This is still a bit manual/interactive, but at least you get to see the actual/exact numeric values used in the boxplot (median, low, high, 25th percentile, 75th percentile). Below is some code:



%let name=plt036;
filename odsout '.';

GOPTIONS DEVICE=activex;
ODS LISTING CLOSE;
ODS HTML path=odsout body="&name..htm";

symbol1 interpol=BOX25 color=black width=1 bwidth=4 mode=include;

title "Activex boxplot: hover over boxes to see values";
proc gplot data=sashelp.cars;
plot msrp * type;
run;

quit;
ODS HTML CLOSE;
ODS LISTING;
SAS Super FREQ
Posts: 925

Re: Numbers gplot creates with symbol interpol=box25 mode=include

Assuming you have SAS 9.2, you can do this using the Graph Template Language. The program below will draw a boxplot without the end caps. I used the ODS OUTPUT statement to generate an output dataset so you can verify the numbers. Let me know if you have any questions.

Thanks!
Dan

proc template;
define statgraph boxplot;
begingraph;
layout overlay;
boxplot x=age y=height / display=(fill mean median outliers);
endlayout;
endgraph;
end;
run;

ods output sgrender=boxdata;
proc sgrender data=sashelp.class template=boxplot; run;

proc print data=box; run;
Ask a Question
Discussion stats
  • 4 replies
  • 374 views
  • 0 likes
  • 3 in conversation