This error is so annoying. As you will note, the syntax is correct.
1661 0 compute Attrition=((Commencing-AwardedComm-TotalContNextYr)/Commencing) * 100. >Error # 4382 on line 1662 in column 1024. Text: (End of Command) >An equals sign was not found when expected after a target variable in a >COMPUTE command. >Execution of this command stops. As you can guess I have been developing a process to determine attrition rates at the educational institution where I work. I have divided my task into six steps. Each of the steps performs calculations that culminate in the sixth step. Using separate steps helps with debugging by keeping each step manageable, and allowing me to keep an grip on what I am trying to achieve. Running each step separately works just fine. In fact, I am happy with what I have done. And then I thought I could improve upon it. (At this point perhaps I should have heeded the view: If it’s not broken, don’t fix it.) Perhaps I tried to get too smart: I created another command file which has nothing more than six INCLUDE FILE commands which point to each of the other six command files. My idea was to run this single command file and that way it ensured I would not forget to run any of the other steps. When I run step 6 on it its own no errors are generated. When step 6 is invoked by the INCLUDE FILE command the error is generated. My first thought was that there was a genuine error; one that I could not see. So, I retyped the line but the error remained. I had actually used include file in one of the early steps. It has a single select statement and nothing else. That works perfectly. |
Administrator
|
The first thing I would try is using INSERT FILE rather than INCLUDE FILE. (I'm speculating that some of the syntax in your included file does not follow "batch rules". (Look at the OVERVIEW sections for INCLUDE and INSERT in the FM for more info.)
Let us know what happens! ;-)
--
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/). |
Tried INSERT. Same result.
|
Administrator
|
Actually, INSERT FILE is the second thing I would try. The first (which you may have already tried) is running the syntax up to but not including the INCLUDE (or INSERT) FILE line, then switching to the included syntax and running it directly. Does that work?
--
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/). |
In reply to this post by Ron0z
The INCLUDE command follows legacy batch
processing rows. Continuation lines must be indented at least one space.
So...
compute <compute expression> will fail regardless of the expression when the file is invoked with INCLUDE, with precisely the error you are getting (which is unfortunately not a very informative error message). By default, INSERT uses interactive rules. Continuation lines do not need to be indented (but you must include the period at the end of the command). So, instead of INCLUDE 'filespec', try INSERT FILE='filespec'. Note that both the FILE keyword and the equals sign (=) are required on the INSERT command. Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] From: Ron0z <[hidden email]> To: [hidden email] Date: 02/21/2016 06:07 PM Subject: INCLUDE FILE issue Sent by: "SPSSX(r) Discussion" <[hidden email]> This error is so annoying. As you will note, the syntax is correct. *1661 0 compute Attrition=((Commencing-AwardedComm-TotalContNextYr)/Commencing) * 100. >Error # 4382 on line 1662 in column 1024. Text: (End of Command) >An equals sign was not found when expected after a target variable in a >COMPUTE command. >Execution of this command stops.* As you can guess I have been developing a process to determine attrition rates at the educational institution where I work. I have divided my task into six steps. Each of the steps performs calculations that culminate in the sixth step. Using separate steps helps with debugging by keeping each step manageable, and allowing me to keep an grip on what I am trying to achieve. Running each step separately works just fine. In fact, I am happy with what I have done. And then I thought I could improve upon it. (At this point perhaps I should have heeded the view: If it’s not broken, don’t fix it.) Perhaps I tried to get too smart: I created another command file which has nothing more than six INCLUDE FILE commands which point to each of the other six command files. My idea was to run this single command file and that way it ensured I would not forget to run any of the other steps. When I run step 6 on it its own no errors are generated. When step 6 is invoked by the INCLUDE FILE command the error is generated. My first thought was that there was a genuine error; one that I could not see. So, I retyped the line but the error remained. I had actually used include file in one of the early steps. It has a single select statement and nothing else. That works perfectly. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/INCLUDE-FILE-issue-tp5731553.html Sent from the SPSSX Discussion mailing list archive at 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 ===================== 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 |
In reply to this post by Ron0z
You haven't shown the actual syntax, so it's hard to tell where the error is, but, apart from using INSERT instead of the old INCLUDE command, IIRC, you can't split a single command across INSERT or INCLUDE files.
On Sunday, February 21, 2016, Ron0z <[hidden email]> wrote: This error is so annoying. As you will note, the syntax is correct. -- ===================== 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 |
In reply to this post by Rick Oliver-3
Thanks for your interest Rick, but each compute was on its own line beginning in char 1 position.
I don’t think the problem has anything to do with INCLUDE. I’m wondering if I’m running out of resources; perhaps SPSS can’t handle as much as I want to do. Though, I’m surprised because I’m not asking it to do very much. I should mention that my code includes macros; don’t know if that makes any difference. You wouldn’t think so. The computes are not within the macro body, they come after. My latest experiment was to combine all six steps (ie. six command files) into a single command file, but that didn’t make any difference, as the following error shows: <compute Attrition=((Commencing-AwardedComm-TotalContNextYr)/Commencing) * 100. compute Progression=(LaterYears/TotalNonAwarded) * 100. >Error # 4382 in column 1024. Text: (End of Command) >An equals sign was not found when expected after a target variable in a >COMPUTE command. >Execution of this command stops. Though here’s the interesting thing: The compute statements are in step6. If I close SPSS then start SPSS again step6 will run error free. If I then run steps5 and step6 together the code runs error free. If I run steps4, 5, 6 together I get the error. The interesting thing is that if I go back and run step6 again by itself the error remains. However, if I then shut SPSS down then start SPSS again, I can then run step6 and its error free again. Steps 1 to 5 when run together run error free. Jon, You were interested in the actual code. Step6 follows: * Input. file handle step4_10 /name = 'I:\SUPPORT_COMMON\Statistics Unit\PLANNING\POLICY\STATS\HigherEd Attrition - SPS\SYS\step4_10.sys'. file handle step4_11 /name = 'I:\SUPPORT_COMMON\Statistics Unit\PLANNING\POLICY\STATS\HigherEd Attrition - SPS\SYS\step4_11.sys'. file handle step4_12 /name = 'I:\SUPPORT_COMMON\Statistics Unit\PLANNING\POLICY\STATS\HigherEd Attrition - SPS\SYS\step4_12.sys'. file handle step4_13 /name = 'I:\SUPPORT_COMMON\Statistics Unit\PLANNING\POLICY\STATS\HigherEd Attrition - SPS\SYS\step4_13.sys'. file handle step4_14 /name = 'I:\SUPPORT_COMMON\Statistics Unit\PLANNING\POLICY\STATS\HigherEd Attrition - SPS\SYS\step4_14.sys'. file handle step4_15 /name = 'I:\SUPPORT_COMMON\Statistics Unit\PLANNING\POLICY\STATS\HigherEd Attrition - SPS\SYS\step4_15.sys'. define summary ( step4 = !tokens(1)/ Commencing = !tokens(1)/ ContNextYr = !tokens(1)/ Awarded = !tokens(1)/ NonAwarded = !tokens(1)/ LaterYears = !tokens(1) ) get file !step4. if (CommencingInd eq 'comm') Commencing = 1. if (CommencingInd eq 'continue') Continuing = 1. aggregate outfile = * /break = EnYr degree /Commencing = sum(Commencing) /Continuing = sum(Continuing) /TotalStudents = n. dataset name !Commencing. get file !step4. select if (CommencingInd eq 'comm') and NOT any(ContNextYr, 'gap', 'n/a', 'N/A'). if (CommencingInd eq 'comm') ContNextYrComm = 1. if (CommencingInd eq 'continue') ContNextYrCont = 1. aggregate outfile = * /break = EnYr degree /ContNextYrComm = sum(ContNextYrComm) /ContNextYrCont = sum(ContNextYrCont) /TotalContNextYr = n. dataset name !ContNextYr. get file !step4. select if (substr(CompletionYr, 1, 1) ne ' ') and (substr(CompletionYr, 5, 1) ne '-'). compute CompYr = number(substr(CompletionYr, 1, 4), F4.0). select if (CompYr eq EnYr). if (CommencingInd eq 'comm') AwardedComm = 1. if (CommencingInd eq 'continue') AwardedCont = 1. aggregate outfile = * /break = EnYr degree /AwardedComm = sum(AwardedComm) /AwardedCont = sum(AwardedCont) /TotalAwarded = n. dataset name !Awarded. get file !step4. if (substr(CompletionYr, 5, 1) eq '-') or (CompletionYr eq ' ') CompletionYr = '9999999'. compute CompYr = number(substr(CompletionYr, 1, 4), F4.0). select if (CompYr ne EnYr). if (CommencingInd eq 'comm') NonAwardedComm = 1. if (CommencingInd eq 'continue') NonAwardedCont = 1. aggregate outfile = * /break = EnYr degree /NonAwardedComm = sum(NonAwardedComm) /NonAwardedCont = sum(NonAwardedCont) /TotalNonAwarded = n. dataset name !NonAwarded. get file !step4. if (substr(CompletionYr, 5, 1) eq '-') or (CompletionYr eq ' ') CompletionYr = '9999999'. compute CompYr = number(substr(CompletionYr, 1, 4), F4.0). select if (CompYr ne EnYr). select if (ProgressionYr ge EnYr + 1). aggregate outfile = * /break = EnYr degree /LaterYears = n. dataset name !LaterYears. !enddefine. summary step4 = step4_11 Commencing = Commencing11 ContNextYr = ContNextYr11 Awarded = Awarded11 NonAwarded = NonAwarded11 LaterYears = LaterYears11. summary step4 = step4_12 Commencing = Commencing12 ContNextYr = ContNextYr12 Awarded = Awarded12 NonAwarded = NonAwarded12 LaterYears = LaterYears12. summary step4 = step4_13 Commencing = Commencing13 ContNextYr = ContNextYr13 Awarded = Awarded13 NonAwarded = NonAwarded13 LaterYears = LaterYears13. summary step4 = step4_14 Commencing = Commencing14 ContNextYr = ContNextYr14 Awarded = Awarded14 NonAwarded = NonAwarded14 LaterYears = LaterYears14. summary step4 = step4_15 Commencing = Commencing15 ContNextYr = ContNextYr15 Awarded = Awarded15 NonAwarded = NonAwarded15 LaterYears = LaterYears15. ******************************************************************************************* match files /file = Commencing11 /file = ContNextYr11 /file = Awarded11 /file = NonAwarded11 /file = LaterYears11 /file = Commencing12 /file = ContNextYr12 /file = Awarded12 /file = NonAwarded12 /file = LaterYears12 /file = Commencing13 /file = ContNextYr13 /file = Awarded13 /file = NonAwarded13 /file = LaterYears13 /file = Commencing14 /file = ContNextYr14 /file = Awarded14 /file = NonAwarded14 /file = LaterYears14 /file = Commencing15 /file = ContNextYr15 /file = Awarded15 /file = NonAwarded15 /file = LaterYears15 /by EnYr degree. execute. dataset close all. if missing(Commencing) Commencing = 0. if missing(Continuing) Continuing = 0. if missing(TotalStudents) TotalStudents = 0. if missing(ContNextYrComm) ContNextYrComm = 0. if missing(ContNextYrCont) ContNextYrCont = 0. if missing(TotalContNextYr) TotalContNextYr = 0. if missing(AwardedComm) AwardedComm = 0. if missing(AwardedCont) AwardedCont = 0. if missing(TotalAwarded) TotalAwarded = 0. if missing(NonAwardedComm) NonAwardedComm = 0. if missing(NonAwardedCont) NonAwardedCont = 0. if missing(TotalNonAwarded) TotalNonAwarded = 0. if missing(LaterYears) LaterYears = 0. compute Attrition=((Commencing-AwardedComm-TotalContNextYr)/Commencing) * 100. compute Progression=(LaterYears/TotalNonAwarded) * 100. formats Attrition Progression (PCT8.1) EnYr (F4.0). list vars = Degree EnYr Attrition Progression Commencing AwardedComm TotalContNextYr Progression LaterYears TotalNonAwarded. |
Ron,
I can't spot the problem this late at night, but here are two tips. Tip 1: this kind of error usually means that something above the point where the error was issued actually caused the problem, for example a missing command terminator, unclosed quote, unclosed block, etc. Tip 2: A blank line is an implicit command terminator, and in breaking up the syntax, a blank line might have been lost or one inserted in the middle of a command. On Sunday, February 21, 2016, Ron0z <[hidden email]> wrote: Thanks for your interest Rick, but each compute was on its own line beginning -- ===================== 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 |
What I see in the first post is hard to figure, but it /seems/ to have an extra
=====================
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
blank line, even given the presence of extra blank lines in the post. *****what I see *1661 0 compute Attrition=((Commencing-AwardedComm-TotalContNextYr)/Commencing) * 100. Error # 4382 on line 1662 in column 1024. Text: (End of Command) An equals sign was not found when expected after a target variable in a COMPUTE command. *****end of extract. This is apparently from the listing of the job, not from the syntax file itself. But it says "an equals sign was not found", and that is a pretty concrete and explicit message. Maybe an image-editor could help to examine that text file for oddities, if it is not just an extra blank line that terminates the Compute before any other syntax. - In the long ago past, I occasionally used odd editors, and suffered the consequences: Lines not properly ended in CR/LF; non-printing characters; and once, a file created without a EOF mark (ctl-Z, I think) at the end. -- Rich Ulrich Date: Sun, 21 Feb 2016 21:11:49 -0700 From: [hidden email] Subject: Re: INCLUDE FILE issue To: [hidden email] Ron, I can't spot the problem this late at night, but here are two tips. Tip 1: this kind of error usually means that something above the point where the error was issued actually caused the problem, for example a missing command terminator, unclosed quote, unclosed block, etc. Tip 2: A blank line is an implicit command terminator, and in breaking up the syntax, a blank line might have been lost or one inserted in the middle of a command. [snip, previous] |
One thing that assures that continuation lines are indented is to
<tools> <indent> <auto indent>. This also makes syntax more readable by people.
Art Kendall
Social Research Consultants |
Oops. You first need to
<edit> <select all>
Art Kendall
Social Research Consultants |
Free forum by Nabble | Edit this page |