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 (July 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 4 Jul 2006 22:56:30 -0400
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: Programming Help (sum of every two row's)

On Tue, 4 Jul 2006 21:25:32 -0400, Kijoeng Nam <kijoeng@GMAIL.COM> wrote:

>Hi, > >I have following data set. > >03/23/2006 00:00:00 0 03/24/2006 00:00:00 29 03/25/2006 00:00:00 0 >03/23/2006 00:00:30 0 03/24/2006 00:00:30 36 03/25/2006 00:00:30 0 >03/23/2006 00:01:00 0 03/24/2006 00:01:00 23 03/25/2006 00:01:00 0 >03/23/2006 00:01:30 0 03/24/2006 00:01:30 24 03/25/2006 00:01:30 0 >03/23/2006 00:02:00 0 03/24/2006 00:02:00 768 03/25/2006 00:02:00 0 >03/23/2006 00:02:30 56 03/24/2006 00:02:30 280 03/25/2006 00:02:30 0 >03/23/2006 00:03:00 0 03/24/2006 00:03:00 34 03/25/2006 00:03:00 0 >03/23/2006 00:03:30 0 03/24/2006 00:03:30 0 03/25/2006 00:03:30 0 >03/23/2006 00:04:00 0 03/24/2006 00:04:00 0 03/25/2006 00:04:00 0 >03/23/2006 00:04:30 0 03/24/2006 00:04:30 0 03/25/2006 00:04:30 0 >03/23/2006 00:05:00 0 03/24/2006 00:05:00 0 03/25/2006 00:05:00 0 >03/23/2006 00:05:30 0 03/24/2006 00:05:30 0 03/25/2006 00:05:30 0 >03/23/2006 00:06:00 0 03/24/2006 00:06:00 0 03/25/2006 00:06:00 0 >03/23/2006 00:06:30 0 03/24/2006 00:06:30 0 03/25/2006 00:06:30 0 >03/23/2006 00:07:00 0 03/24/2006 00:07:00 0 03/25/2006 00:07:00 0 >03/23/2006 00:07:30 0 03/24/2006 00:07:30 0 03/25/2006 00:07:30 0 >03/23/2006 00:08:00 0 03/24/2006 00:08:00 0 03/25/2006 00:08:00 0 >03/23/2006 00:08:30 0 03/24/2006 00:08:30 0 03/25/2006 00:08:30 0 > > >you will find that the first column is the day/time, the >second column is the score. > > I'd like to compute the total score of every two rows - which is the total >of every minute >(each row's score was obtained in 30 seconds, that's why two >rows are one minute). > >How can I do this? > >Thanks in advance.

Try:

data sample; input date : mmddyy10. time time8. score @@; format date date9. time hhmm.; cards; 03/23/2006 00:00:00 0 03/24/2006 00:00:00 29 03/25/2006 00:00:00 0 03/23/2006 00:00:30 0 03/24/2006 00:00:30 36 03/25/2006 00:00:30 0 03/23/2006 00:01:00 0 03/24/2006 00:01:00 23 03/25/2006 00:01:00 0 03/23/2006 00:01:30 0 03/24/2006 00:01:30 24 03/25/2006 00:01:30 0 03/23/2006 00:02:00 0 03/24/2006 00:02:00 768 03/25/2006 00:02:00 0 03/23/2006 00:02:30 56 03/24/2006 00:02:30 280 03/25/2006 00:02:30 0 03/23/2006 00:03:00 0 03/24/2006 00:03:00 34 03/25/2006 00:03:00 0 03/23/2006 00:03:30 0 03/24/2006 00:03:30 0 03/25/2006 00:03:30 0 03/23/2006 00:04:00 0 03/24/2006 00:04:00 0 03/25/2006 00:04:00 0 03/23/2006 00:04:30 0 03/24/2006 00:04:30 0 03/25/2006 00:04:30 0 03/23/2006 00:05:00 0 03/24/2006 00:05:00 0 03/25/2006 00:05:00 0 03/23/2006 00:05:30 0 03/24/2006 00:05:30 0 03/25/2006 00:05:30 0 03/23/2006 00:06:00 0 03/24/2006 00:06:00 0 03/25/2006 00:06:00 0 03/23/2006 00:06:30 0 03/24/2006 00:06:30 0 03/25/2006 00:06:30 0 03/23/2006 00:07:00 0 03/24/2006 00:07:00 0 03/25/2006 00:07:00 0 03/23/2006 00:07:30 0 03/24/2006 00:07:30 0 03/25/2006 00:07:30 0 03/23/2006 00:08:00 0 03/24/2006 00:08:00 0 03/25/2006 00:08:00 0 03/23/2006 00:08:30 0 03/24/2006 00:08:30 0 03/25/2006 00:08:30 0 ;

proc summary data=sample nway; class date time; var score; output out=sums sum=; run;

The format assigned to the TIME variable is critical, since PROC SUMMARY pays attention to that.


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