Date: Tue, 28 Oct 2008 03:07:21 -0700
Reply-To: Patrick <patrick.matter@GMX.CH>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Patrick <patrick.matter@GMX.CH>
Organization: http://groups.google.com
Subject: Re: Numbering missing visits
Content-Type: text/plain; charset=ISO-8859-1
May be something like that?
data visit;
input pt:$1 visdat:date. visitid :$1.;
format visdat date.;
cards;
1 12JAN2008 1 .
1 20JAN2008 2 .
1 03FEB2008 M 1
1 15FEB2008 M 2
2 03JAN2008 1 .
2 27JAN2008 M 1
2 12FEB2008 2 .
2 25FEB2008 3 .
2 12MAR2008 M 1
2 28MAR2008 M 2
2 19APR2008 M 3
;;;;
run;
proc sort data=visit;
by pt visdat;
run;
data visit;
/* call missing(count); */
do until(last.visitID);
set work.visit;
by pt visitID notsorted;
if visitID eq 'M' then count + 1;
else count=.;
output;
end;
run;
proc print;
run;
|