|
The thing I'm really wondering about is why ODS behaves as it does, and
whether there is a way to make it produce a different structure for the
OUTPUT destination.
On Fri, 25 Oct 2002 16:13:49 -0400, Howard_Schreier@ITA.DOC.GOV wrote:
>Summary: Output datasets from MEANS/SUMMARY do not in general have a
>convenient structure. ODS seems to have a parallel deficiency.
>
>I started looking hard at this last week in an attempt to assist a
>colleague. I thought I'd find an easy fix, but I don't see it yet.
>Perhaps I'm missing something.
>
>The problem arises when PROC MEANS (or SUMMARY) is asked to produce
>multiple statistics for multiple analysis variables. The issue is the
>shape of the output dataset.
>
>Here is the input dataset I will use to illustrate.
>
> data test;
> input var1 var2;
> cards;
> 1 2
> 3 8
> 3 6
> ;
>
>Suppose I need the MIN and MAX stats for both variables. That's easy to do:
>
> proc means data=test noprint;
> output out=meansout(drop=_type_ _freq_) min= max= / autoname;
> run;
>
>The result:
>
> var1_Min var2_Min var1_Max var2_Max
>
> 1 2 3 8
>
>The output is in what I call the "spread" shape, with a single
>observation holding all of the results (or, more generally, a single
>observation for each CLASS level for each CLASS intersection type in
>each BY group).
>
>But that's not a particularly handy structure.
[snip]
>But it occurred to me that ODS ought to be useful here. This code sends
>the results of PROC MEANS to the listing destination (by default) and to
>the output destination:
>
> ods trace on;
> ods output summary=stats_from_ods;
> proc means data=test min max;
> run;
> ods output close;
> ods trace off;
>
>Here's what appears in the listing destination:
>
> Variable Minimum Maximum
>
> var1 1.0000000 3.0000000
> var2 2.0000000 8.0000000
>
>So I expected to get a Var x Stat grid structure in the output
>destination. But in fact STATS_FROM_ODS looks like this:
>
>
> VName_ VName_
> var1 var1_Min var1_Max var2 var2_Min var2_Max
>
> var1 1 3 var2 2 8
>
>It is a dataset with the spread structure, very similar to the
>one created with the OUTPUT statement and the AUTONAME option.
>
>So the listing and output destinations have different structures,
>despite the fact that there is but one ODS table definition, which can
>be dumped with this step:
>
> proc template; source base.summary; run;
>
>My conclusion at this point is that ODS can't help here.
>
>Comments and suggestions welcome.
|