Date: Wed, 31 Jan 1996 13:17:31 PST
Reply-To: Prasad S Ravi <prasad@IMMUNEX.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Prasad S Ravi <prasad@IMMUNEX.COM>
Subject: Hint me Please.
I have a study which has multiple SAS datasets, what I need
to do with these is:
1. If two variables PATNO and SITE exists in a dataset I have to count
the no of unique SITEs for each PATNO, and print out the
PATNOs which have more than one SITE. Tough part of this qn is how to
find out existance of particular variables in each dataset of the
study. Remember I don't know the # and names of datasets of the
study. I just know the directory of the study which has several
datasets.
2. Assuming that a PATNO has a unique SITE I have to check that PATNO
has the same SITE across all the datasets of the study, ofcourse for
only those datasets which contain those two variables.
I was able to do part of my 1st qn. i.e, using PROC CONTENTS I output
the names of datasets of the study into a output dataset, using SYMPUT
function I found out the # of datasets in the study, and using SQL in
a DO loop I counted the # of unique SITEs for each PATNO in each
dataset. Before doing this I removed the datasets by hardcoding which
didn't contain those two variables(which I want SAS code to do
itself). I know from PROC CONTENTS one can also output the variable
names of each dataset but don't know to check for particular variable.
How can one go about checking if a particular variable exist in each
dataset of the study or not?, secondly how can I compare variables
across all datasets?.
Thanx for any help.
Prasad Ravi.
Immunex Corporation
Seattle, WA.