Posted by
Bruce Weaver on
URL: http://spssx-discussion.165.s1.nabble.com/Comment-generates-errors-tp5740837p5740842.html
Well-spotted, Art.
Here is a revised version of Andy's code with the offending periods removed and comments amended suitably. I also added one other variation on Andy's LOOP that causes something very odd to happen to the colour-coding of the COMPUTE commands: When I start the line with ., + or - to make the nesting clearer, the final E on each COMPUTE command has no colour-coding. COMPUT has colour-coding, but not the final E. Very strange!
DATA LIST LIST /
A B (2F8.0).
BEGIN DATA
1 1
END DATA.
DATASET NAME CommentErrors.
COMPUTE C = A * B.
EXECUTE. /* Works, but no colour-coding on either EXECUTE command */
EXECUTE.
COMPUTE D = A * B. /* Works, but no colour-coding on EXECUTE */
EXECUTE.
COMPUTE E = A * B. /*works.
EXECUTE.
COMPUTE F = A * B.
/*works, but no colour-coding on EXECUTE */
EXECUTE.
IF (A EQ 1) G = A * B. /*works.
EXECUTE.
IF (A EQ 1) H = A * B. /* Works, but no colour-coding on EXECUTE */
EXECUTE.
COMPUTE J = 0.
LOOP # = 1 TO 10. /*loop works, no colour coding on COMPUTE */
COMPUTE J = J + A.
END LOOP.
EXECUTE.
COMPUTE J = 0.
LOOP # = 1 TO 10.
COMPUTE J = J + A.
END LOOP. /* Works, but LOOP is red, no colour-coding for END LOOP or EXECUTE */
EXECUTE.
* Here is one more Andy did not include.
* The next structure generates no errors, but the final E on
* each COMPUTE is NOT colour-coded. I've noticed this for years,
* and always found it very strange.
LOOP # = 1 TO 10.
. COMPUTE X = J + A.
+ COMPUTE Y = J + A.
- COMPUTE Z = J + A.
END LOOP.
EXECUTE.
Art Kendall wrote
/* */. with the period causes error message problem
COMPUTE C = A * B.
EXECUTE. /* error: EXECUTE Unrecognized text appears on the EXECUTE command. This command allows no subcommands. */. << remove this period
COMPUTE D = A * B. /*error: COMPUTE Incorrect variable name: either the name is more than 64 characters, or it is not defined by a previous command. */. << remove this period
EXECUTE.
Removing the period does not fix the LOOP coloring in the syntax window.
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/"When all else fails, RTFM."
PLEASE NOTE THE FOLLOWING:
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (
https://listserv.uga.edu/).