In reply to Bartosz Jabłoński.

Thanks for the program. I told a colleague last week that I expected a reader to write in with a hash tables solution. I'm glad that you did not disappoint me!

As you might expect, this is a simplified presentation of a more complicated scenario. In case you are interested, the actual application of this technique (that is, why I needed it) in discussed in the article "Annotate features of a schematic box plot in SGPLOT". To goal of that article is to modify the output from PROC BOXPLOT in the case where the data set has no outliers or has only high outliers (or only low outliers). For example, the following data do not contain any low outliers, so the output from PROC BOXPLOT does not contain all the observations I need to annotate a box plot.

data Have(keep= Group x);
call streaminit(54321);
Group=1; /* required for PROC BOXPLOT */
do i = 1 to 20;
x = rand("LogNormal", 0, 1.5); /* normal data */
output;
end;
run;

/* Step 3: Compute values for box plot features: Mean, lower/upper whiskers, outliers */
proc boxplot data=Have;
plot x*Group / boxstyle=schematic outbox=Test;
run;

proc print data=outbox;
where _Type_ in ('MIN', 'MAX' 'MEAN' 'HIGH' 'LOW' 'FARHIGH' 'FARLOW' 'HIWHISKR' 'LOWHISKR');
var _Type_ _Value_;
run;

%let dsname = Test; /* use OUTBOX= data for the rest of the analysis */