pspp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CTABLES and intersecting PCOMPUTEs


From: Ben Pfaff
Subject: CTABLES and intersecting PCOMPUTEs
Date: Wed, 6 Jul 2022 22:55:56 -0700

I'm working on the CTABLES procedure. I'm trying to understand how PCOMPUTE should work when multiple postcomputes intersect each other. For example, consider the following syntax:

DATA LIST LIST NOTABLE/x y z.
WEIGHT by z.
FORMATS ALL (F1.0).
VARIABLE LEVEL x y (NOMINAL).
BEGIN DATA.
1 4 5
1 5 2
1 6 9
2 4 2
2 5 3
2 6 4
3 4 1
3 5 6
3 6 1
END DATA.

CTABLES    /PCOMPUTE &a = EXPR([1] + [2])
    /PCOMPUTE &b = EXPR([2] + [3])
    /PCOMPUTE &c = EXPR([4] * [5])
    /PCOMPUTE &d = EXPR([5] * [6])
    /TABLE x BY y
    /CATEGORIES VARIABLES=x [1, &a, 2, &b, 3]
    /CATEGORIES VARIABLES=y [4, &c, 5, &d, 6].

Currently, in my implementation, the output is the following:
                  Custom Tables
╭───────────┬─────────────────────────────────────╮
│           │                  y                  │
│           ├─────┬─────────┬─────┬─────────┬─────┤
│           │  4  │[4] * [5]│  5  │[5] * [6]│  6  │
│           ├─────┼─────────┼─────┼─────────┼─────┤
│           │Count│  Count  │Count│  Count  │Count│
├───────────┼─────┼─────────┼─────┼─────────┼─────┤
│x 1        │    5│       10│    2│       18│    9│
│  [1] + [2]│    7│        .│    5│        .│   13│
│  2        │    2│        6│    3│       12│    4│
│  [2] + [3]│    3│        .│    9│        .│    5│
│  3        │    1│        6│    6│        6│    1│
╰───────────┴─────┴─────────┴─────┴─────────┴─────╯
Notice the cells with "." in them where the PCOMPUTEs intersect. I don't know what should go in those boxes.  Consider the upper-left one, where [1] + [2] intersects with [4] * [5]. If we follow the rule for [1] + [2], then we'd have 10 + 6 = 16 there.  If we follow the rule for [4] * [5], we'd have 7 * 5 = 35 there. Is leaving it missing the right thing to do? Am I misunderstanding something?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]