Has anyone ever encountered this issue when generating code using the
decision tree module? The code that gets generated seems to randomly split
statements across multiple lines. In most cases, the syntax is still
correct. But, in cases where an END IF statement is split between the END
and the IF, an actual syntax error results. Here's an example of what I
mean - first a non-issue (but still odd) where the COMPUTE nod_001 = 8
statement is split across lines.
/* Node 8 */.
DO IF (SYSMIS(var1) OR VALUE(var1) NE 1) AND (VALUE(var2) EQ 1) AND
(SYSMIS(var3) OR (VALUE(var3) GT 39 AND VALUE(var3) LE 40)).
COMPUTE
nod_001 = 8.
COMPUTE pre_001 = 0.
COMPUTE prb_001 = 0.686813.
END IF.
EXECUTE.
- next, the real issue, where the END IF is split
/* Node 9 */.
DO IF (SYSMIS(var1) OR VALUE(var1) NE 1) AND (VALUE(var2) EQ 1) AND
(VALUE(var3) GT 40).
COMPUTE nod_001 = 9.
COMPUTE pre_001 = 1.
COMPUTE prb_001 = 0.546547.
END
IF.
EXECUTE.
Yes, I *can* fix it by hand, but that takes time and poking around.
Besides, at a minimum, I would expect SPSS to be generating syntax that is
syntactically correct.
If you're interested, here's what the decision tree build syntax looks like.
******.
TREE
outcome
BY
var1
var2
var3
varN
/TREE DISPLAY=TOPDOWN NODES=STATISTICS BRANCHSTATISTICS=YES NODEDEFS=YES
SCALE=AUTO
/DEPCATEGORIES USEVALUES=[.0 1.00] TARGET=[1.0]
/PRINT MODELSUMMARY CLASSIFICATION RISK
/RULES NODES=TERMINAL SYNTAX=INTERNAL TYPE=SCORING
OUTFILE='spss_decisiontree.sps'
/SAVE NODEID PREDPROB
/GAIN CATEGORYTABLE=YES TYPE=[NODE] SORT=DESCENDING CUMULATIVE=NO
/PLOT GAIN INCREMENT=1
/METHOD TYPE=CHAID
/GROWTHLIMIT MAXDEPTH=AUTO MINPARENTSIZE=100 MINCHILDSIZE=50
/VALIDATION TYPE=CROSSVALIDATION(3) OUTPUT=BOTHSAMPLES
/CHAID ALPHASPLIT=0.05 ALPHAMERGE=0.05 SPLITMERGED=NO CHISQUARE=PEARSON
CONVERGE=0.001
MAXITERATIONS=100 ADJUST=BONFERRONI INTERVALS=3
/COSTS EQUAL.
If anyone has a workaround or other fix, I'd appreciate it. Thanks,
-Tim
=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD