Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- Graphics
- /
- Numbers gplot creates with symbol interpol=box25 mode=include

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 01-14-2010 11:31 AM
(1506 views)

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

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

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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;

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;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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;

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;

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. **Registration is now open through August 30th**. Visit the SAS Hackathon homepage.

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.