A syntax issue

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

A syntax issue

Ron0z
I’ve been running a series of command files for a few years. First, when I
had v22 installed (it ran with no problems) then recently in v25 (it ran
with no problems). I make minor changes from time to time as required, but
generally nothing much changes in these command files.

There are several discrete command files that I call by using INCLUDE FILE.
Yesterday this ran without error. However, today I got some errors. I’ve
edited the code and fixed it, but I’m wondering why it’s so?

This lot is in a command file:
* GENERATE DATA.  
include file = 'I:\CORS\SPSS\SYSGEN\2019\SPS\02a 2019 Identify VFH
Programs.sps'.
include file = 'I:\CORS\SPSS\SYSGEN\2019\SPS\02b 2019 PROCESS v6
NAT030_0_D_E.sps'.
include file = 'I:\CORS\SPSS\SYSGEN\2019\SPS\04 2019 PROCESS NAT080.sps'.
include file = 'I:\CORS\SPSS\SYSGEN\2019\SPS\10 2019 COGen.sps'.
include file = 'I:\CORS\SPSS\SYSGEN\2019\SPS\11 2019 PROCESS v6
NAT120_0_E.sps'.
include file = 'I:\CORS\SPSS\SYSGEN\2019\SPS\20 2019 EnolmentGen.sps'.
include file = 'I:\CORS\SPSS\SYSGEN\2019\SPS\30 2019 ClientGen.sps'.

I got an error flagged in command file ‘20 2019 EnolmentGen.sps'. This file
had the following code:

do if (StudType eq 'U') and (StudAttribute eq 'TACT') and (College eq 'SO').
+ compute StudType = 'H'.
+ compute FundSrce = 2.
end if.

It’s been this way for so long I can’t remember, but today spss turned on
me, and reported the following error:

9208  0  do if (StudType eq 'U') and (StudAttribute eq 'TACT') and (College
eq 'SO').
9210  0  + compute StudType = 'H'.

Warning # 207 on line 49210 in column 22.  Text: H
A '+' was found following a text string, indicating continuation, but the
next
non-blank character was not a quotation mark or an apostrophe.
9211  1  + compute FundSrce = 2.

Error # 4381 on line 49210 in column 26.  Text: compute
The expression ends unexpectedly.
Execution of this command stops.

 
I use “+” a lot in DO IF statements. It makes the code easier to read. I
like nice formatting and it helps.

Here’s the interesting thing: When I ran ‘20 2019 EnolmentGen.sps' on its
own, the code ran without error. It was only when that command file was part
of the INCLUDE FILE that an error resulted.

Of course the very interesting thing: It ran perfectly yesterday but not
today. It’s like IBM did a remote upgrade or something.

And my fix was to remove the + like the following code, and it worked
perfectly:
do if (StudType eq 'U') and (StudAttribute eq 'TACT') and (College eq 'SO').
compute StudType = 'H'.
compute FundSrce = 2.
end if.

What's wrong with using the + to help format the code?






--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: A syntax issue

Jon Peck
INCLUDE uses batch style formatting rules.  INSERT uses interactive style rules and is generally preferred.  Since it worked when run directly from a syntax window, I presume, and would therefore be processed by interactive rules, that’s probably where the problem lies.

SPSS doesn’t do silent remote upgrades.  My guess is that there is a new line break in there somewhere or an expected one removed, but I can’t tell without seeing the actual file that failed.

On Mon, Feb 4, 2019 at 8:43 PM Ron0z <[hidden email]> wrote:
I’ve been running a series of command files for a few years. First, when I
had v22 installed (it ran with no problems) then recently in v25 (it ran
with no problems). I make minor changes from time to time as required, but
generally nothing much changes in these command files.

There are several discrete command files that I call by using INCLUDE FILE.
Yesterday this ran without error. However, today I got some errors. I’ve
edited the code and fixed it, but I’m wondering why it’s so?

This lot is in a command file:
* GENERATE DATA.   
include file = 'I:\CORS\SPSS\SYSGEN\2019\SPS\02a 2019 Identify VFH
Programs.sps'.
include file = 'I:\CORS\SPSS\SYSGEN\2019\SPS\02b 2019 PROCESS v6
NAT030_0_D_E.sps'.
include file = 'I:\CORS\SPSS\SYSGEN\2019\SPS\04 2019 PROCESS NAT080.sps'.
include file = 'I:\CORS\SPSS\SYSGEN\2019\SPS\10 2019 COGen.sps'.
include file = 'I:\CORS\SPSS\SYSGEN\2019\SPS\11 2019 PROCESS v6
NAT120_0_E.sps'.
include file = 'I:\CORS\SPSS\SYSGEN\2019\SPS\20 2019 EnolmentGen.sps'.
include file = 'I:\CORS\SPSS\SYSGEN\2019\SPS\30 2019 ClientGen.sps'.

I got an error flagged in command file ‘20 2019 EnolmentGen.sps'. This file
had the following code:

do if (StudType eq 'U') and (StudAttribute eq 'TACT') and (College eq 'SO').
+ compute StudType = 'H'.
+ compute FundSrce = 2.
end if.

It’s been this way for so long I can’t remember, but today spss turned on
me, and reported the following error:

9208  0  do if (StudType eq 'U') and (StudAttribute eq 'TACT') and (College
eq 'SO').
9210  0  + compute StudType = 'H'.

Warning # 207 on line 49210 in column 22.  Text: H
A '+' was found following a text string, indicating continuation, but the
next
non-blank character was not a quotation mark or an apostrophe.
9211  1  + compute FundSrce = 2.

Error # 4381 on line 49210 in column 26.  Text: compute
The expression ends unexpectedly.
Execution of this command stops.


I use “+” a lot in DO IF statements. It makes the code easier to read. I
like nice formatting and it helps.

Here’s the interesting thing: When I ran ‘20 2019 EnolmentGen.sps' on its
own, the code ran without error. It was only when that command file was part
of the INCLUDE FILE that an error resulted.

Of course the very interesting thing: It ran perfectly yesterday but not
today. It’s like IBM did a remote upgrade or something.

And my fix was to remove the + like the following code, and it worked
perfectly:
do if (StudType eq 'U') and (StudAttribute eq 'TACT') and (College eq 'SO').
compute StudType = 'H'.
compute FundSrce = 2.
end if.

What's wrong with using the + to help format the code?






--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
--
Jon K Peck
[hidden email]

===================== 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