Date: Wed, 30 Oct 2002 15:15:27 GMT
Reply-To: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Organization: EarthLink Inc. -- http://www.EarthLink.net
Subject: Re: MEANS/SUMMARY Output Datasets (Long)
Content-Type: text/plain;
"Peter Crawford" <peter.crawford@DB.COM> wrote in message
news:OFEEB53E2A.C488C6C3-ON41256C61.006EFF8E@db.com...
> does it add significantly to have one output statement
> for each required statistic ?
> Then the result data can be available (as one)
> in the structure that seemed to be wanted, by
> using an interleaving set, datastep view
> proc means <data= > <missing> <nway> noprint;
> class &classVars ;
> var &analyVars ;
> < ways N ; ** and many additional good v8 features; >
> output out = &outputDS._N N= ;
> output out = &outputDS._nMiss nMiss= ;
> output out = &outputDS._Min Min= ;
> output out = &outputDS._Max Max= ;
> output out = &outputDS._Sum Sum= ;
> .....with many more lines like these, they might be better
> generated by a list generating macro .......
> run;
> data allResults / view=allResults ;
> set
> &outputDS._N
> &outputDS._nMiss
> &outputDS._Min
> &outputDS._Max
> ................ etc(linked to that list generator) ;
> by _type_ &classVars ;
> run;
>
>
>
> Of course, this method depends on proc means not
> having to pass the data for each output statement .....
> Any advisors on that, please come forward ....
>
>
> Regards
> Peter Crawford
>
>snip
MEANS appears to intelligently pass the data when multiple OUTPUT
statements are indicated. CPU time increases in small increments as more
different statistics are requested. More complicated calculations (e.g.
css, q1) result in greater time increments.
Real time also bounces around in an increasing manner as more and more
tables need to be written (increases would be impacted by system i/o
performance.)
data phake;
do level_1 = 'A', 'E', 'I';
do level_2 = 'I', 'O', 'U';
do level_3 = 0 to 5000;
n = 40*ranuni(0);
do i = 1 to n;
x1_longNameMightNotBeSoGoodToday = ranuni(0);
x2 = int (10*ranuni(0));
y1_longNameMightNotBeSoGoodToday = 50+50*ranuni(0);
output;
end;
end;end;end;
keep level: x: y:;
run cancel;
%macro means (data=phake:, class=level:, ways=3, var=x: y:, stats=);
proc means noprint data=&data;
class &class;
var &var;
ways &ways;
%local i stat;
%let i=1;
%do %while (%scan (&stats, &i) ne);
%let stat = %scan (&stats, &i);
output out=_&stat &stat=;
%let i=%eval(&i+1);
%end;
%if &i=1 %then
output out=_stats;
;
run;
%mend;
%means (stats=)
%means (stats=mean)
%means (stats=mean min)
%means (stats=mean min max)
%means (stats=mean min max n)
%means (stats=mean min max n nmiss)
%means (stats=mean min max n nmiss std)
%means (stats=mean min max n nmiss std range)
%means (stats=mean min max n nmiss std range css)
%means (stats=mean min max n nmiss std range css q1)
* not too helpful tabulate analog to means;
ods listing close;
ods output table=_statsTable;
proc tabulate data=phake;
class level:;
var x: y:;
table
level_1
* level_2
* level_3
* ( x1_longNameMightNotBeSoGoodToday
x2
y1_longNameMightNotBeSoGoodToday
)
, N
MIN
MAX
MEAN
STD
RANGE
;
run;
ods output close;
--
Richard A. DeVenezia
http://www.devenezia.com/downloads/sas/macros/#FindFiles
Get file information from Windows