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