Date: Sat, 22 Nov 2003 17:51:06 GMT
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: Function to select one record in each of multiple subsets of
records
Theodore,
Like the example, below, I think that a sort with nodupkey will accomplish
your task.
Art
data one;
infile cards truncover ;
input ID BeginDate mmddyy10. EndDate mmddyy10.;
DateRange = range(BeginDate,EndDate);
cards;
1 11/25/1997 01/21/1999
2 12/16/2000 12/20/2001
3 02/21/2000 02/21/2002
4 12/10/1999 12/10/2000
2 10/14/1955 01/12/1998
2 01/01/2002 11/22/2003
3 02/21/1956 02/20/2000
;
run;
proc sort data=one out=two;
by id descending DateRange;
run;
proc sort data=two out=three nodupkey;
by id;
run;
-------
"Theodore" <tsmonk@eudoramail.com> wrote in message
news:3FBF84BE.7000206@eudoramail.com...
> Hello!
> Does anyone know of a way to compare valuss in a specified field among
> a subset of records and write to a new file only one record that
> satisfies a given criterion (e.g. the longest job duration, among
> multiple jobs held by one respondent), and then repeat the process over
> a very large number of subsets (e.g. respondents in my example above --
> the has records for jobs held by respondents)? I can't find a SAS
> function that can do this, so I am seeking confirmation that it cannot
> be done in SAS. Thanks.
>
|