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.
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
|