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 (June 2003, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 23 Jun 2003 15:01:47 -0400
Reply-To:   "Cacialli, Doug" <Doug_Cacialli@URMC.ROCHESTER.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Cacialli, Doug" <Doug_Cacialli@URMC.ROCHESTER.EDU>
Subject:   Re: first and last
Content-Type:   text/plain

Supposing that she did want the first observation for each value of COLDATE, is there a way to accomplish that using PROC SQL?

-----Original Message----- From: Prasad S Ravi [mailto:prasad.s.ravi@HOUSEHOLD.COM] Sent: Monday, June 23, 2003 1:47 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: first and last

Your right Nat, I jump the gun here, didn't read the last line of her post.

which can also achieved easily by PROC SQL. (since dat is already sortedby coldate according to her code)

proc sql; create table dat1 as select min(coldate) as var1 format=mmddyy8., max(coldate) as var2 format=mmddyy8. from dat; quit; run;

Prasad Ravi.

Nathaniel_Wooding@dom .com To: Prasad S Ravi <prasad.s.ravi@HOUSEHOLD.COM> cc: 06/23/2003 10:34 AM Subject: Re: first and last

Prasad

Unless I am realling reading her question wrong, what she wants is more along the lines of

data dat; input coldate mmddyy8.; cards; 04/24/2002 01/02/1960 01/02/1960 05/10/2002 01/02/1960 01/02/1960 05/17/2002 01/02/1960 01/01/1960 05/17/2002 01/01/1960 01/02/1960 05/29/2002 01/02/1960 01/02/1960 06/05/2002 01/02/1960 01/02/1960 data dat1; set dat end=eof; ** note this parameter; ** by statement is not needed; format var1 var2 mmddyy10.; if _n_=1 then var1=coldate; retain var1; * we need to hang on to the value of var1; drop coldate; if eof then do; var2=coldate; output; end; ** note that you will wind up with only one output record; proc print; run;

Nat Wooding


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