Date: Wed, 10 Apr 2002 12:19:48 -0400
Reply-To: "Huang, Ya" <ya.huang@PFIZER.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Huang, Ya" <ya.huang@PFIZER.COM>
Subject: Re: how to get several summary stats from proc report
Content-Type: text/plain; charset="iso-8859-1"
Hi Scott,
You want to use compute block. The following
code is based on an Onlinc Doc example for proc
report:
http://sasdocs.ats.ucla.edu/proc/z2-ex3.htm
options nocenter;
proc report data=sashelp.class nowindows headline;
column sex age height weight
age=amean age=amin age=amax
height=hmean height=hmin height=hmax
weight=wmean weight=wmin weight=wmax;
;
define sex / 'Sex' width=3 order;
define age/'age';
define height / 'height' ;
define weight/'weight';
define amean / analysis mean noprint;
define amin / analysis min noprint;
define amax / analysis max noprint;
define hmean / analysis mean noprint;
define hmin / analysis min noprint;
define hmax / analysis max noprint;
define wmean / analysis mean noprint;
define wmin / analysis min noprint;
define wmax / analysis max noprint;
compute after sex;
line @4 35*'-';
line @4 'Mean: ' @11 amean 6.2 @22 hmean 6.2 @33 wmean 6.2;
line @4 'Min:' @11 amin 6.2 @22 hmin 6.2 @33 wmin 6.2;
line @4 'Max:' @11 amax 6.2 @22 hmax 6.2 @33 wmax 6.2;
line @4 35*'-';
endcomp;
run;
----------------------------------------
Sex age height weight
--------------------------------------
F 13 56.5 84
13 65.3 98
14 62.8 102.5
12 59.8 84.5
15 62.5 112.5
11 51.3 50.5
14 64.3 90
12 56.3 77
15 66.5 112
-----------------------------------
Mean: 13.22 60.59 90.11
Min: 11.00 51.30 50.50
Max: 15.00 66.50 112.50
-----------------------------------
M 14 69 112.5
14 63.5 102.5
12 57.3 83
13 62.5 84
12 59 99.5
16 72 150
12 64.8 128
15 67 133
11 57.5 85
15 66.5 112
-----------------------------------
Mean: 13.40 63.91 108.95
Min: 11.00 57.30 83.00
Max: 16.00 72.00 150.00
-----------------------------------
HTH
Ya Huang
-----Original Message-----
From: Miller, Scott [mailto:smiller@WVMI.ORG]
Sent: Wednesday, April 10, 2002 7:08 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: how to get several summary stats from proc report
i have done a simple proc report to show indicator rates by facility, easy
enough. what i want to get on several summary lines is not only a mean, but
a second summary line for min and max values.
proc report data=combine2 headline headskip;
column dummy facility p3_base p3_curr p3_cum p3_den;
define facility / group width=8;
define dummy / group noprint;
define p3_base / mean format=8.3 width=20;
define p3_curr / mean format=8.3 width=20;
define p3_cum / mean format=8.3 width=20;
define p3_den / sum format=8.0 width=20;
break after dummy/ summarize dol dul;
run;
when i run this i get a summary line at bottom with the mean value for
p3_base and p3_curr and p3_cum and the sum of p3_den. what i need to have
is a second summary line that contains the min values of these, and another
line for the max values. can this be done with proc report? the data has
one record for each facility and their avg rate for each indicator. TIA
Scott D. Miller, MA
Evaluation and Informatics Analyst
West Virginia Medical Institute
(304) 346-9864 ext 2240
Every good scientist should be one part P.T. Barnum and one part B.F.
Skinner.
The goal of science is to build better mousetraps. The goal of nature is to
build better mice.
Sumus quid sumus