LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2002, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 29 Oct 2002 16:11:42 -0500
Reply-To:   Howard_Schreier@ITA.DOC.GOV
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Howard_Schreier@ITA.DOC.GOV
Subject:   Re: MEANS/SUMMARY Output Datasets (Long)

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.


Back to: Top of message | Previous page | Main SAS-L page