I have an SPSS datafile. I want to get the number of cases that take
the value 1 for one variable and the value 2 for the other variable .
Afterwards i need to divide the result "the number of cases satisfying
both conditions" by the total number of cases taking the value 1 in
variable 1. I want to get the final result "the proportion" written to
an SPSS datafile and I want all this to be performed using the SPSS
commands.
Is this possible,
Really need your help,
A.A.A
new file.
dataset close all.
data list list / v1 v2 (2f2.0).
begin data
1 2
1 1
2 2
1 2
3 4
5 4
end data.
compute v1eq1 = (v1 EQ 1).
compute v2eq2 = (v2 EQ 2).
compute both = v1eq1 and v2eq2.
compute nobreak = 1.
exe.
aggregate outfile = * mode = addvariables /
break = nobreak /
v1count = sum(v1eq1) /
bothcount = sum(both) .
compute prop = bothcount / v1count.
format prop (f5.3).
temporary.
select if $casenum EQ 1.
list v1count to prop.
--
Bruce Weaver
bwe...@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/Home
"When all else fails, RTFM."