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 (November 2001, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 15 Nov 2001 17:26:43 -0500
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:      Q on proc report, compute block?
Content-Type: text/plain; charset="iso-8859-1"

Hi there,

This might be too long, please bear with me.

Basically I want to use proc report because I have to present both detailed rows and some summary result. Unfortunately, I need "median" which can only be calculated by proc univariate (yes, this is for SAS 6.12), steps 2-6 is to manipulate data, so that it has necessary vars for proc report compute block.

I would like to summarize by study and also for all studies at the end of the list.

data xx; input study $ sex $ age ncrs desc $; cards; B F 67 8 stst B F 34 10 sdfsaf B M 55 7 sdryts B M 73 7 werwer B M 46 9 sdgsf A M 45 3 abcd A M 65 4 bdrf A F 46 3 lsdfsd A F 67 5 sdfas ;

proc sort; by study;

proc univariate noprint data=xx; by study; var age ncrs; output out=temp n=n1 median=m1 m2;

proc univariate noprint data=xx; var age ncrs; output out=temp1 n=on1 median=om1 om2;

data xx; merge xx temp; by study;

proc sql; create table xx as select xx.*, temp1.* from xx, temp1 order by study ;

options nocenter; proc report nowd headline; column on1 om1 om2 n1 m1 m2 study sex age ncrs desc; define study / width=5 order; define sex / width=3 order; define age / width=3; define ncrs / width=5; define n1/noprint order; define m1/noprint order; define m2/noprint order; define on1/noprint order; define om1/noprint order; define om2/noprint order; compute after study; line ' '; line 'N=' n1 3.; line 'Median age=' m1 5.1; line 'Median CRS=' m2 5.1; line ' '; endcomp; compute after; line ' '; line 'Total N=' on1 3.; line 'Overall Median age=' om1 5.1; line 'Overall Median CRS=' om2 5.1; line ' '; endcomp; run;

----------------------------- study sex age ncrs desc ------------------------------------- A F 46 3 lsdfsd 67 5 sdfas M 65 4 bdrf 45 3 abcd

N= 4 Median age= 55.5 Median CRS= 3.5

B F 34 10 sdfsaf 67 8 stst M 55 7 sdryts 46 9 sdgsf 73 7 werwer

N= 5 Median age= 55.0 Median CRS= 8.0

Total N= . Overall Median age= . Overall Median CRS= .

Now my question is why the second compute block dose not work?

Thanks.

Ya Huang


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