Date: Thu, 19 Apr 2007 08:58:50 -0400
Reply-To: "data _null_;" <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_;" <datanull@GMAIL.COM>
Subject: Re: Dups and date - urgent
In-Reply-To: <1176935983.204528.43330@e65g2000hsc.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Then don't sort use PROC SUMMARY.
data work.test;
input (F1 F2 F3 F4)($) date:yymmdd10.;
format date yymmdd10.;
cards;
ab ff gg hg 20070505
ab ff gg jj 20040701
ab fh ht kkk 20040404
ab ff gg gggg 20040508
;;;;
run;
proc summary data=work.test nway;
class f1 f2 f3;
output out=work.minDate(drop=_type_ _freq_)
idgroup(min(date) out(date f4)=)
;
run;
proc print;
run;
On 4/18/07, sdlenter <sdlentert@aol.com> wrote:
> On Apr 18, 2:55 pm, Huang...@PRINCIPAL.COM ("Huang, JS") wrote:
> > This is an approach:
> >
> > data Given;
> > input F1 $ F2 $ F3 $ F4 $ date:yymmdd8.;
> > format date mmddyy10.;
> > datalines;
> > ab ff gg hg 20070505
> > ab ff gg jj 20040701
> > ab fh ht kkk 20040404
> > ab ff gg gggg 20040508
> > ;
> >
> > proc sort data=Given;
> > by F1 F2 F3 date;
> > run;
> >
> > data Result;
> > set Given;
> > by F1 F2 F3;
> > if first.F3 then output;
> > run;
> >
> > proc print;
> > run;
> >
> > ***** Output *****
> > The SAS System 16:51
> > Wednesday, April 18, 2007 4
> >
> > Obs F1 F2 F3 F4 date
> >
> > 1 ab ff gg gggg 05/08/2004
> > 2 ab fh ht kkk 04/04/2004
> >
> >
> >
> > -----Original Message-----
> > From: SAS(r) Discussion [mailto:S...@LISTSERV.UGA.EDU] On Behalf Of
> >
> > sdlenter
> > Sent: Wednesday, April 18, 2007 4:42 PM
> > To: S...@LISTSERV.UGA.EDU
> > Subject: Dups and date - urgent
> >
> > Urgent! Need help...
> > Using Dataset and Not proc SQL 'having min' function
> >
> > I have sas dataset
> > F1 F2 F3 F4 date
> > ab ff gg hg 20070505
> > ab ff gg jj 20040701
> > ab fh ht kkk 20040404
> > ab ff gg gggg 20040508
> >
> > I need to have a table with unique records , based on F1, F2, and F3
> > field ONLY and keeping one reccord with the earliest date among the dups
> >
> > so the new table will be
> > F1 F2 F3 F4 date
> > ab fh ht kkk 20040404
> > ab ff gg gggg 20040508
> >
> > thank you!
> >
> > -----Message Disclaimer-----
> >
> > This e-mail message is intended only for the use of the individual or
> > entity to which it is addressed, and may contain information that is
> > privileged, confidential and exempt from disclosure under applicable law.
> > If you are not the intended recipient, any dissemination, distribution or
> > copying of this communication is strictly prohibited. If you have
> > received this communication in error, please notify us immediately by
> > reply email to Conn...@principal.com and delete or destroy all copies of
> > the original message and attachments thereto. Email sent to or from the
> > Principal Financial Group or any of its member companies may be retained
> > as required by law or regulation.
> >
> > Nothing in this message is intended to constitute an Electronic signature
> > for purposes of the Uniform Electronic Transactions Act (UETA) or the
> > Electronic Signatures in Global and National Commerce Act ("E-Sign")
> > unless a specific statement to the contrary is included in this message.
> >
> > While this communication may be used to promote or market a transaction
> > or an idea that is discussed in the publication, it is intended to provide
> > general information about the subject matter covered and is provided with
> > the understanding that The Principal is not rendering legal, accounting,
> > or tax advice. It is not a marketed opinion and may not be used to avoid
> > penalties under the Internal Revenue Code. You should consult with
> > appropriate counsel or other advisors on all matters pertaining to legal,
> > tax, or accounting obligations and requirements.- Hide quoted text -
> >
> > - Show quoted text -
>
> I cannot sort it, the dataset is too big
>
|