Here is one approach...
infile cards missover;
input ID Diag $;
create table need as
select diag, count(*) as count
where id in (select distinct id
where upcase(diag) = 'A')
group by diag
proc print data = need;
Center for Health Program Development and Management
University of Maryland, Baltimore County
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Peter Müller
Sent: Tuesday, November 27, 2007 1:36 PM
Subject: aggregate or restructure data set
Dear list members,
i'm new to SAS and have a question concerning the restructuring or
aggregating of variables:
I've two variables:
The 1st is the ID and the 2nd are diagnostics for this patients.Everyone of
those can have different diagnostics.
I want to receive a dataset, that lists all additional diagnostics, when a
special diagnostic is true.
I want to have those diagnostics, when A has been found. in this case
for ID 1 and 3, so that the result looks like: