Date: Fri, 22 Sep 2006 16:03:43 -0400
Reply-To: Zach Peery <zpeery@NATURE.BERKELEY.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Zach Peery <zpeery@NATURE.BERKELEY.EDU>
Subject: Problem with PROC FREQ
Hi All,
I have a dataset setup to try and estimate the frequency of occurrence of
variables states for all possible PAIRWISE comparisons of variables.
(e.g., State I and J of Variable 1 vs State P and R of Variable 2). EZ,
except that I need to include combinations of States in the output dataset
for which there are zero occurrences. In the example input dataset at the
bottom there were no observations with State J for variable 1 and State Q
for variable 2 so the output dataset should have a row that looks like
this:
VarA VarB StateOfVarA StateOfVarB COUNT
var1 var2 J Q 0
I've tried:
proc freq data=data noprint;
tables VarA*VarB*StateOfVarA*StateOfVarB / out=Frequencies sparse;
but the problem with this approach is that it outputs states that dont
exist (e.g. State Z for Variable 1).
Example input data set:
VarA VarB StateOfVarA StateOfVarB
var1 var2 I P
var1 var2 I Q
var1 var2 J P
var1 var3 I Y
var1 var3 I Z
var1 var3 J Y
var1 var3 J Z
var2 var3 etc...
etc....
In reality there are many variables and many states per variable...Many
thanks for any help. Zach