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 (March 2002, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 28 Mar 2002 12:08:17 -0500
Reply-To:   Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject:   Re: DATE
Content-Type:   text/plain; charset=ISO-8859-1

On Thu, 28 Mar 2002 10:49:45 -0600, Mai To <mto@ADMIN4.HSC.UTH.TMC.EDU> wrote:

>My dataset has these info: > >Emp.ID Name Hire date Termination date >10000 Smith, A 1996-03-15 1996-12-31 >10000 Smith, A 1997-05-17 1998-05-16 >10000 Smith, A 2000-02-15 >10001 White, M 1996-04-28 >10002 Darcy, R 2000-02-13 2002-01-31 >10002 Darcy, R 1997-06-10 1999-08-31 > >What I'm trying to do is to find the LATEST hire date, exp. Smith, A >would have 2000-02-15, Darcy R would have 2000-02-13. > >I have the input data as follow: > >Data date; > Infile date; > Input @ 5 Empid $5. > @ 20 Name $30. > @ 55 Hire $10. > @ 70 Term $10.; > >Proc sort data=date; > By descending Hire; > >Data date2; set date; > By descending Hire; > >Proc sort data=date2; > By Empid; > >Data date3; set date2; > By Empid; > If first.empid; > >It gave me the result I need, but is there a shorter/better way? > >Your help is very much appreciated. > >Mia >

What you can do insted is:

1. read the hire date as numeric, e.g. with

input .... §55 hire : yymmdd10. ..

then use

proc summary data=... nway; class empid name; var hire; output out=x max=; run;

I'd prefer reading ALL dates as numeric. Also with your method that would be better.


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