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 (September 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 1 Sep 2008 15:08:42 -0400
Reply-To:   msz03@albany.edu
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Mike Zdeb <msz03@ALBANY.EDU>
Subject:   Re: Keeping first and every 30th record
Content-Type:   text/plain;charset=iso-8859-1

hi ... if you are sure that you have data for each age and they are in age order, the MOD function solution posted by Alex is fine

but, since you are looking for observations based on the value of the variable AGE, why not use that variable value rather than position in the data set to select observations

data ds2; set ds1; where age eq 1 or mod(age,30) eq 0; run;

-- Mike Zdeb U@Albany School of Public Health One University Place Rensselaer, New York 12144-3456 P/518-402-6479 F/630-604-1475

> Hello everyone, I have a dataset, ds1 made up of age(days) and height, ht > (cm). The age begins from day 1 through to day 300. I want to have an > output,ds2 starting at day 1, then day 30, 60,90….. day 300. ie. I want to > pull out from ds1, days 1,30,60,….300,with their heights (ht’s). ie. > day1,day 30 and every 30th record up to the end of the dataset. > > Ds1 > age ht > 1 13 > 2 17 > 3 22 > 4 26 > 5 22 > ... > 30 44 > 31 46 > .. > 270 145 > 271 144 > .. > 300 298 > > > ds2 > age ht > 1 13 > 30 44 > 60 55 > 90 89 > 120 123 > 150 150 > 180 166 > 210 195 > 240 242 > 270 145 > 300 298 > > • ie. in Ds2(output), I want to keep day 1 and every 30th record up > to the end (day300), along with their corresponding ht. > • Could someone help me with the SAS code, please to arrive at ds2? > >


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