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 (March 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 6 Mar 2006 22:32:28 -0500
Reply-To:   "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:   Re: how to calculate such a mean value?

On Sun, 5 Mar 2006 09:13:56 -0800, nichas <sachin.gadkar@GMAIL.COM> wrote:

>this sql code also gives you the dataset means which contains the >required mean of the data given by you. > >data one; > input id return; >datalines; >1 0.64336 >1 0.75877 >1 0.53997 >1 0.75732 >1 0.82422 >1 0.61018 >1 0.8767 >10001 0.62921 >10001 0.4848 >10001 0.6444 >10001 0.73933 >10001 0.598 >10001 0.64459 >2001 0.58357 >2001 0.57786 >2001 0.68543 >2001 0.06881 >2001 0.61868 >2001 0.54126 >2001 0.65157 >; >run; > >proc sql noprint; > create table means as > select id, sum(return)/count(id) as mean

Why construct this formula instead of simply using the MEAN function? If there are missing values of RETURN, it will implicitly treat them as zeroes, which is probably not desirable. If such treatment is appropriate, better to explicate with a CASE structure.

> from one > group by id; >quit;


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