Turf Analysis Question

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Turf Analysis Question

Eddy Crane
I am trying to create a syntax file for a TURF analysis (Total
Unduplicated Reach and Frequency) and I am having some problems.  I hope
someone can help.

Lets say I have 3 flavors, then the total number of combinations equals
to 7 (2^#flavors - 1)

1 2 3
1 2
1 3
2 3
1
2
3

and I have a data set that looks something like

DATA LIST LIST /a1 a2 a3 .
BEGIN DATA
0    1    0
1    0    1
1    1    0
0    0    0
1    0    1
0    0    0
1    0    1
1    0    1
0    0    0
1    0    1
END DATA.

How can I match the first list to my data in a way that it will give me
a data set that looks like

DATA LIST /c1 c2 c3 c12 c23 c13 c123.
BEGIN DATA
0    1    0    1    1    0    1
1    0    1    1    1    2    2
1    1    0    2    1    1    2
0    0    0    0    0    0    0
1    0    1    1    1    2    2
0    0    0    0    0    0    0
1    0    1    1    1    2    2
1    0    1    1    1    2    2
0    0    0    0    0    0    0
1    0    1    1    1    2    2
END DATA.

Where essentially the data generated for the second list is

compute c1 = a1.
compute c2 = a2.
compute c3 = a3.
compute c12 = (a1 + a2).
compute c23 = (a2 + a3).
compute c13 = (a1 + a3).
compute c123 = (a1 + a2 + a3).
exe.

I have been able to generate the combinations, but I am having trouble
figuring out a way to compute the(baskets) combined variables(c1, c2,
c3, c12, c23, c13, c123)  based on the data a1 to a3.

Does anyone have any idea how to write a  macro to generate the compute
statements for all combinations of variables?

Thanks

Eddy