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 (May 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 12 May 2009 17:56:14 -0400
Reply-To:     Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:      Re: repeated merging with no ID variable
Comments: To: nchapinal@YAHOO.COM


Couldn't you accomplish what you want with something like:?

data want; set have; by animal; if first.ANIMAL then hour=0; else hour+1; run;

Art ------- On Tue, 12 May 2009 14:49:23 -0700, nuria <nchapinal@YAHOO.COM> wrote:

>Let's say I have a dataset that contains a bunch of animals. There are >24 observations per animal of variable1, that is, for example the mins >that each animal spends eating each hour of the day. > >ANIMAL VARIABLE1 >1 33 >1 45 >1 34 >1 20 >.... > >I want to add a new column called "hour" that contains the hour of the >day, from 0 to 23. The original dataset is in the right order. In >Excel, I would create column that went from 0 to 23 and would copy it >repeatedly.... but I have tones of animals, so it is not >convinient.... > > > >ANIMAL VARIABLE1 HOUR >1 33 0 >1 45 1 >1 34 2 >1 20 3 >.... > >Thanks!

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