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 (April 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 9 Apr 2009 12:53:08 -0400
Reply-To:     Kevin Viel <citam.sasl@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Kevin Viel <citam.sasl@GMAIL.COM>
Subject:      Re: Means

On Wed, 8 Apr 2009 12:04:09 -0400, Randy <randistan69@HOTMAIL.COM> wrote:

>My data is as follows: > >date time ID VarA >Mar1 9:00 XA 45 >Mar1 9:00 XA 16 >Mar1 10:00 XA 34 >Mar1 10:01 XB 16 >Mar1 10:02 XD 17 >Mar1 10:05 XM 18 >Mar1 10:05 XM 19 >Mar1 10:34 XM 20 > >I want to sum and get the average of these variables. But every ID at the >same time has to be grouped as one, before I take the average of these >variables. So for example, on Mar1 XA at 9:00 has to be grouped as one, and >so should XM at 10:05. So the data set should first look like before I take >the averages. > date time ID VarA >Mar1 9:00 XA 61 >Mar1 10:00 XA 34 >Mar1 10:01 XB 16 >Mar1 10:02 XD 17 >Mar1 10:05 XM 37 >Mar1 10:34 XM 20 > >This operation can be performed in two data steps. Is there a way to do it >in one data step?

In one data step? Sure, and you have already received some suggestions. You could also do it with the MEAN procedure, if you use it twice. This has several advantages, including ease of maintainence and it is rather concise.

What is the purpose of this analysis? Why do you have multiple observations for some and uneven time intervals? As either a reviewer or a reader, information concerning the percision, i.e. CV and number of observations, would be valuable.

Replacing a series of observations with the mean of them might be more accurate, but what about the other observations that have only one measurement?

HTH,

Kevin


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