Date: Wed, 5 Nov 2003 11:54:57 -0500
Reply-To: Peter Crawford <Peter@CRAWFORDSOFTWARE.DEMON.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Peter Crawford <Peter@CRAWFORDSOFTWARE.DEMON.CO.UK>
Subject: Re: Retain statment
Hi
here is an example using retain.
To watch the movement of the diab_found status,
comment the drop statement.
data resolved;
set <your sas data set>;
by patient ; /* declared: sorted by patient and date*/
if first.patient then
do;
diab_found =0 ;
inf_diab =0 ;
end;
retain diab_found inf_diab ;
drop diab_found ;
if not inf_diab then
do;
if diagnose = 410 then
do;
if diab_found >0 then inf_diab = 1;
else diab_found= -1; /* too late*/
end;
else if diagnose = 250 and not diab_found
then diab_found = 1;
end;
run;
|