LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (October 1999, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 11 Oct 1999 12:48:21 -0400
Reply-To:   Julia Hertl <jah12@CORNELL.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Julia Hertl <jah12@CORNELL.EDU>
Subject:   SOLVED: Looking at 5 consecutive observations
Content-Type:   text/plain; charset="us-ascii"

Hi SAS-L, Many thanks for all the great solutions to this problem. We ended up using Ian Whitlock's solution:

data cows ; input COW DIM PROG ; cards ; 1 14 410 1 16 450 1 18 520 1 21 600 1 23 590 1 25 610 1 28 660 1 30 490 1 32 510 1 35 540 1 37 550 1 39 520 1 41 550 2 13 420 2 15 510 2 17 530 2 20 550 2 22 420 2 24 520 2 27 530 2 29 540 2 31 560 2 34 570 3 13 450 3 15 400 3 17 550 3 19 520 3 22 380 3 24 500 3 26 340 ;

data cycles ( keep = cow cycle ) ; retain cycle ; set cows ; by cow ; if first.cow then cycle = . ; if prog >= 500 and cycle = . then do ; cycle = dim ; cnt = 0 ; end ; cnt + 1 ; if cnt <= 4 and prog < 500 then cycle = . ; if last.cow ; run ;

data cows ; merge cows cycles ; by cow ; run ;

It worked perfectly! Thanks again.

Julia Hertl Section of Epidemiology Dept. of Population Medicine and Diagnostic Sciences College of Veterinary Medicine Cornell University Ithaca, NY 14853


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