|
Something like:
DATA DIFF0 DIFF1 DIFF2 DIFF3 DIFF4 DIFF5 DIFF6 DIFF7;
SET PATEVENT(KEEP=PATID EVENTDAT);
BY PATID EVENTDAT;
RETAIN PREVDATE;
IF FIRST.PATID THEN PREVDATE=EVENTDAT;
ELSE SELECT(EVENTDAT-PREVDATE);
WHEN(0) OUTPUT DIFF0;
WHEN(1) OUTPUT DIFF1;
...
OTHERWISE;
END;
RUN;
Then SORT NODUPKEY by PATID to remove duplicates.
NOTE: EVENTDAT is not required in the BY statement in the main datastep--I just
coded it so that mis-sorted files would generate an error. Cheap insurance.
Tim Berryhill - Contract Programmer and General Wizard
TWB2@PGE.COM or http://www.aartwolf.com/twb.html
Frequently at Pacific Gas & Electric Co., San Francisco
The correlation coefficient between their views and
my postings is slightly less than 0
----------------------[Reply - Original Message]----------------------
I have a number of patients with a number of event dates. I would like
to create datasets with patients who have more than one event at the
same date, more than one event within 1, 2, 3, 4, 5, 6, 7 days.
|