Date: Mon, 10 Aug 2009 12:37:42 -0400
Reply-To: Nathaniel Wooding <nathaniel.wooding@DOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nathaniel Wooding <nathaniel.wooding@DOM.COM>
Subject: Re: how can you solve this senaro
In-Reply-To: <200908101425.n7AAmi78005365@malibu.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"
Here is another solution that uses a couple sorts and a data step.
Nat Wooding
Data one;
informat patid 8. scode $2. ;
input PATID SCODE PERIOD CYCE TRT SH;
cards;
5001 A11 1 1 1 47.447
5001 B50 1 1 1 48.417
5001 A50 2 1 5 67.519
5001 A61 2 1 5 64.062
5001 D40 3 1 2 21.049
5001 D41 3 1 2 20.947
run;
Data one;
set one;
obs + 1;
run;
Proc sort data = one;
by descending obs;
run;
Data One;
set one;
by notsorted period;
if first.period then do;
num = 0;
sum = 0;
end;
num + 1;
sum + SH;
if last.period then Mean_SH = sum/num;
drop sum num ;
run;
Proc sort data = one out = one ( drop = obs );
by obs;
run;
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Shaik Hymad
Sent: Monday, August 10, 2009 10:26 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: how can you solve this senaro
HI ALL,
PATID SCODE PERIOD CYCE TRT SH
5001 A11 1 1 1 47.447
5001 B50 1 1 1 48.417
5001 A50 2 1 5 67.519
5001 A61 2 1 5 64.062
5001 D40 3 1 2 21.049
5001 D41 3 1 2 20.947
I need output like
PATID SCODE PERIOD CYCE TRT SH msh
5001 A11 1 1 1 47.447 47.93
5001 B50 1 1 1 48.417 .
5001 A50 2 1 5 67.519 65.7907
5001 A61 2 1 5 64.062 .
5001 D40 3 1 2 21.049 20.994
5001 D41 3 1 2 20.947 .
how can we find mean and solve this situvation
and i need above output like above one
CONFIDENTIALITY NOTICE: This electronic message contains
information which may be legally confidential and or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect. The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it. Thank you.