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 (October 2002, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 31 Oct 2002 13:10:37 -0500
Reply-To:     "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Subject:      Re: BY var Qn.
Comments: cc: Jeff Morison <jmt_mtf@YAHOO.COM>
Content-Type: text/plain

> From: Jeff Morison [mailto:jmt_mtf@YAHOO.COM] > > I have a dataset with multiple records for a each new > value of the variable, I need to grab the first 4 > records for each different value of the variable. > > How can I do that?.

data FIRST4; set DATA; by Var; if first.Var then Cntr=1; else Cntr++1;; if Cntr le 4 then output;

Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov

--> cheerful provider of UNTESTED SAS code from the Clue?Gee!Wrx <--

"Nothing is particularly hard if you divide it into small jobs." - Henry Ford, Industrialist


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