

It seems possible to add calculations in CTABLES. However, when I try to add the interquartile range to the quartiles, it doesn't work. Instead of the differences between Q3 and Q1 within groups I get the differences between Q3 and Q1 respectively *between* groups. Some simplified syntax:
DATA LIST LIST/group(F1) hrate(F3).
BEGIN DATA
1 69
1 72
1 75
1 77
2 61
2 66
2 61
2 68
2 77
END DATA.
DATASET NAME heart_rates.
* Custom Tables.
CTABLES /TABLE hrate [PTILE 25, PTILE 75] BY group.
* Custom Tables.
CTABLES
/PCOMPUTE &iqr=EXPR([2][1])
/PPROPERTIES &iqr LABEL ='IQR'
/TABLE group BY hrate [PTILE 25, PTILE 75]
/CATEGORIES VARIABLES=group [1,2,&iqr].
Am I missing something here?
Robert
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Robert Lundqvist


The PCOMPUTE expression operates on the categories for each statistic, not the statistics for each category.
However, you can do this computation using STATS TABLE CALC (Utilities > Calculate with Pivot table). Here is the syntax for this particular calculation between the columns of statistics.
STATS TABLE CALC SUBTYPE="customtable" PROCESS=PRECEDING /TARGET FORMULA="x['Percentile 75']  x['Percentile 25']" LOCATION=1 LABEL="Iqr" MODE=AFTER.
This operates on the immediately preceding table of type "customtable". By default it works on columns. The columns are numbered counting from 0, so LOCATION=1 MODE=AFTER means to insert the new column after the second column of the table.
The formula here is expressed in terms of the innermost column labels (Percentile 75 and Percentile 25). The minus sign inside the brackets says to look to the left of the target column for these labels. Alternatively, the input columns in the formula can be referred to numerically relative to the target column (before the insertion), in this case as FORMULA="x[0]  x[1]".
You can see the full syntax for this command by placing the cursor on an instance in the Syntax Editor and pressing F1.
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Hi,
While running the following syntax I am getting the error

hrate

Percentile 25

Percentile 75

group

1

71

76

2

61

68

Warnings

16619,An error occured in the Pivot Table.,

My syntax is as follows
Custom Tables.
CTABLES
/PCOMPUTE &iqr=EXPR([2][1])
/PPROPERTIES &iqr LABEL ='IQR1'
/TABLE group BY hrate [PTILE 25, PTILE 75]
/CATEGORIES VARIABLES=group [1,2].
STATS TABLE CALC SUBTYPE="CustomTable" PROCESS=PRECEDING
/TARGET FORMULA="x['Percentile 75']  x['Percentile 25']" Dimension=Columns LOCATION=1 LABEL="Iqr" MODE=AFTER.
Please let me know the error in the syntax.
Regards
Manoj
From: SPSSX(r) Discussion <[hidden email]>
On Behalf Of Jon Peck
Sent: 22 March 2018 19:28
To: [hidden email]
Subject: Re: CTABLES  computations
The PCOMPUTE expression operates on the categories for each statistic, not the statistics for each category.
However, you can do this computation using STATS TABLE CALC (Utilities > Calculate with Pivot table). Here is the syntax for this particular calculation between the columns of statistics.
STATS TABLE CALC SUBTYPE="customtable" PROCESS=PRECEDING
/TARGET FORMULA="x['Percentile 75']  x['Percentile 25']"
LOCATION=1 LABEL="Iqr" MODE=AFTER.
This operates on the immediately preceding table of type "customtable". By default it works on columns. The columns are numbered counting from 0, so LOCATION=1 MODE=AFTER means to insert the new column after
the second column of the table.
The formula here is expressed in terms of the innermost column labels (Percentile 75 and Percentile 25). The minus sign inside the brackets says to look to the left of the target column for these labels.
Alternatively, the input columns in the formula can be referred to numerically relative to the target column (before the insertion), in this case as FORMULA="x[0]  x[1]".
You can see the full syntax for this command by placing the cursor on an instance in the Syntax Editor and pressing F1.
On Thu, Mar 22, 2018 at 6:18 AM, Robert Lundqvist <[hidden email]> wrote:
It seems possible to add calculations in CTABLES. However, when I try to add the interquartile range to the quartiles, it doesn't work. Instead of the differences between Q3 and Q1 within groups I get the differences between Q3 and Q1 respectively
*between* groups. Some simplified syntax:
DATA LIST LIST/group(F1) hrate(F3).
BEGIN DATA
1 69
1 72
1 75
1 77
2 61
2 66
2 61
2 68
2 77
END DATA.
DATASET NAME heart_rates.
* Custom Tables.
CTABLES /TABLE hrate [PTILE 25, PTILE 75] BY group.
* Custom Tables.
CTABLES
/PCOMPUTE &iqr=EXPR([2][1])
/PPROPERTIES &iqr LABEL ='IQR'
/TABLE group BY hrate [PTILE 25, PTILE 75]
/CATEGORIES VARIABLES=group [1,2,&iqr].
Am I missing something here?
Robert
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD

===================== To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the command. To leave the list, send the command SIGNOFF SPSSXL For a list of commands to manage subscriptions, send the command INFO REFCARD
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD


I ran a table that looks like yours in V25+fixpack and did not see a problem. If you want to send me an spv file containing this table, I'll take another look. Also, what version of Statistics are you using? On Thu, Aug 9, 2018 at 4:56 AM Arora, Manoj (IMDLR) < [hidden email]> wrote:
Hi,
While running the following syntax I am getting the error

hrate

Percentile 25

Percentile 75

group

1

71

76

2

61

68

Warnings

16619,An error occured in the Pivot Table.,

My syntax is as follows
Custom Tables.
CTABLES
/PCOMPUTE &iqr=EXPR([2][1])
/PPROPERTIES &iqr LABEL ='IQR1'
/TABLE group BY hrate [PTILE 25, PTILE 75]
/CATEGORIES VARIABLES=group [1,2].
STATS TABLE CALC SUBTYPE="CustomTable" PROCESS=PRECEDING
/TARGET FORMULA="x['Percentile 75']  x['Percentile 25']" Dimension=Columns LOCATION=1 LABEL="Iqr" MODE=AFTER.
Please let me know the error in the syntax.
Regards
Manoj
From: SPSSX(r) Discussion <[hidden email]>
On Behalf Of Jon Peck
Sent: 22 March 2018 19:28
To: [hidden email]
Subject: Re: CTABLES  computations
The PCOMPUTE expression operates on the categories for each statistic, not the statistics for each category.
However, you can do this computation using STATS TABLE CALC (Utilities > Calculate with Pivot table). Here is the syntax for this particular calculation between the columns of statistics.
STATS TABLE CALC SUBTYPE="customtable" PROCESS=PRECEDING
/TARGET FORMULA="x['Percentile 75']  x['Percentile 25']"
LOCATION=1 LABEL="Iqr" MODE=AFTER.
This operates on the immediately preceding table of type "customtable". By default it works on columns. The columns are numbered counting from 0, so LOCATION=1 MODE=AFTER means to insert the new column after
the second column of the table.
The formula here is expressed in terms of the innermost column labels (Percentile 75 and Percentile 25). The minus sign inside the brackets says to look to the left of the target column for these labels.
Alternatively, the input columns in the formula can be referred to numerically relative to the target column (before the insertion), in this case as FORMULA="x[0]  x[1]".
You can see the full syntax for this command by placing the cursor on an instance in the Syntax Editor and pressing F1.
On Thu, Mar 22, 2018 at 6:18 AM, Robert Lundqvist <[hidden email]> wrote:
It seems possible to add calculations in CTABLES. However, when I try to add the interquartile range to the quartiles, it doesn't work. Instead of the differences between Q3 and Q1 within groups I get the differences between Q3 and Q1 respectively
*between* groups. Some simplified syntax:
DATA LIST LIST/group(F1) hrate(F3).
BEGIN DATA
1 69
1 72
1 75
1 77
2 61
2 66
2 61
2 68
2 77
END DATA.
DATASET NAME heart_rates.
* Custom Tables.
CTABLES /TABLE hrate [PTILE 25, PTILE 75] BY group.
* Custom Tables.
CTABLES
/PCOMPUTE &iqr=EXPR([2][1])
/PPROPERTIES &iqr LABEL ='IQR'
/TABLE group BY hrate [PTILE 25, PTILE 75]
/CATEGORIES VARIABLES=group [1,2,&iqr].
Am I missing something here?
Robert
=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD

===================== To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the command. To leave the list, send the command SIGNOFF SPSSXL For a list of commands to manage subscriptions, send the command INFO REFCARD

=====================
To manage your subscription to SPSSXL, send a message to
[hidden email] (not to SPSSXL), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSXL
For a list of commands to manage subscriptions, send the command
INFO REFCARD

