Greeting, Listers,
I have a python program which I have tried to run with SPSS Statistics in
different ways.
With SPSS Statistics client up and running, I’ve run the program by
selecting File �C> Open Script... , which invoked Python IDLE and shell. I
then ran the program by clicking Utilities �C> Run Script..., which doesn’t
invoke Python IDLE or shell and operate on the IBM SPSS
Statistics client.
Lastly, I tried copying and pasting the code of the python program between
BEGIN PROGRAM PYTHON. and END PROGRAM on SPSS Syntax editor. But this way
doesn’t work for SPSS Statistics appears not to recognize the Python commands.
For example,
BEGIN PROGRAM PYTHON.
import spss
END PROGRAM.
The above code invoke the following error:
import spss
END PROGRAM.
>Error # 5712 in column 8. Text: spss
>A valid IMPORT subcommand name is expected but not found.
Recognized
>subcommands are FILE, TYPE, KEEP, DROP, RENAME, and MAP.
>Execution of this command stops.
What could be the problem and how can I fix it?
Thanks! |
Did you install the Python plug-in for
SPSS Statistics?
Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] From: Chichi Shu <[hidden email]> To: [hidden email], Date: 01/17/2014 01:20 PM Subject: Running Python scripts from SPSS Statistics Syntax Editor Sent by: "SPSSX(r) Discussion" <[hidden email]> Greeting, Listers, I have a python program which I have tried to run with SPSS Statistics in different ways. With SPSS Statistics client up and running, I’ve run the program by selecting File –> Open Script... , which invoked Python IDLE and shell. I then ran the program by clicking Utilities –> Run Script..., which doesn’t invoke Python IDLE or shell and operate on the IBM SPSS Statistics client. Lastly, I tried copying and pasting the code of the python program between BEGIN PROGRAM PYTHON. and END PROGRAM on SPSS Syntax editor. But this way doesn’t work for SPSS Statistics appears not to recognize the Python commands. For example, BEGIN PROGRAM PYTHON. import spss END PROGRAM. The above code invoke the following error: import spss END PROGRAM. >Error # 5712 in column 8. Text: spss >A valid IMPORT subcommand name is expected but not found. Recognized >subcommands are FILE, TYPE, KEEP, DROP, RENAME, and MAP. >Execution of this command stops. What could be the problem and how can I fix it? Thanks! |
It’s SPSS statistics 22, which comes with it.
From: [hidden email]
Sent: Friday, January 17, 2014 2:24 PM
To: [hidden email]
Cc: [hidden email]
Subject: Re: Running Python scripts from SPSS Statistics Syntax
Editor Did you install the Python plug-in for SPSS
Statistics? Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] From: Chichi Shu <[hidden email]> To: [hidden email], Date: 01/17/2014 01:20 PM Subject: Running Python scripts from SPSS Statistics Syntax Editor Sent by: "SPSSX(r) Discussion" <[hidden email]> Greeting, Listers, I have a python program which I have tried to run with SPSS Statistics in different ways. With SPSS Statistics client up and running, I’ve run the program by selecting File –> Open Script... , which invoked Python IDLE and shell. I then ran the program by clicking Utilities –> Run Script..., which doesn’t invoke Python IDLE or shell and operate on the IBM SPSS Statistics client. Lastly, I tried copying and pasting the code of the python program between BEGIN PROGRAM PYTHON. and END PROGRAM on SPSS Syntax editor. But this way doesn’t work for SPSS Statistics appears not to recognize the Python commands. For example, BEGIN PROGRAM PYTHON. import spss END PROGRAM. The above code invoke the following error: import spss END PROGRAM. >Error # 5712 in column 8. Text: spss >A valid IMPORT subcommand name is expected but not found. Recognized >subcommands are FILE, TYPE, KEEP, DROP, RENAME, and MAP. >Execution of this command stops. What could be the problem and how can I fix it? Thanks! |
In reply to this post by Rick Oliver-3
Bummer, I restarted it and it worked.
From: [hidden email]
Sent: Friday, January 17, 2014 2:24 PM
To: [hidden email]
Cc: [hidden email]
Subject: Re: Running Python scripts from SPSS Statistics Syntax
Editor Did you install the Python plug-in for SPSS
Statistics? Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] From: Chichi Shu <[hidden email]> To: [hidden email], Date: 01/17/2014 01:20 PM Subject: Running Python scripts from SPSS Statistics Syntax Editor Sent by: "SPSSX(r) Discussion" <[hidden email]> Greeting, Listers, I have a python program which I have tried to run with SPSS Statistics in different ways. With SPSS Statistics client up and running, I’ve run the program by selecting File –> Open Script... , which invoked Python IDLE and shell. I then ran the program by clicking Utilities –> Run Script..., which doesn’t invoke Python IDLE or shell and operate on the IBM SPSS Statistics client. Lastly, I tried copying and pasting the code of the python program between BEGIN PROGRAM PYTHON. and END PROGRAM on SPSS Syntax editor. But this way doesn’t work for SPSS Statistics appears not to recognize the Python commands. For example, BEGIN PROGRAM PYTHON. import spss END PROGRAM. The above code invoke the following error: import spss END PROGRAM. >Error # 5712 in column 8. Text: spss >A valid IMPORT subcommand name is expected but not found. Recognized >subcommands are FILE, TYPE, KEEP, DROP, RENAME, and MAP. >Execution of this command stops. What could be the problem and how can I fix it? Thanks! |
Well, that's good, because I was going
to suggest uninstalling and reinstalling. :)
Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] From: Chichi Shu <[hidden email]> To: Rick Oliver/Chicago/IBM@IBMUS, Cc: <[hidden email]> Date: 01/17/2014 01:48 PM Subject: Re: Running Python scripts from SPSS Statistics Syntax Editor Bummer, I restarted it and it worked. From: Rick Oliver Sent: Friday, January 17, 2014 2:24 PM To: Chichi Shu Cc: [hidden email] Subject: Re: Running Python scripts from SPSS Statistics Syntax Editor Did you install the Python plug-in for SPSS Statistics? Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] From: Chichi Shu <[hidden email]> To: [hidden email], Date: 01/17/2014 01:20 PM Subject: Running Python scripts from SPSS Statistics Syntax Editor Sent by: "SPSSX(r) Discussion" <[hidden email]> Greeting, Listers, I have a python program which I have tried to run with SPSS Statistics in different ways. With SPSS Statistics client up and running, I’ve run the program by selecting File –> Open Script... , which invoked Python IDLE and shell. I then ran the program by clicking Utilities –> Run Script..., which doesn’t invoke Python IDLE or shell and operate on the IBM SPSS Statistics client. Lastly, I tried copying and pasting the code of the python program between BEGIN PROGRAM PYTHON. and END PROGRAM on SPSS Syntax editor. But this way doesn’t work for SPSS Statistics appears not to recognize the Python commands. For example, BEGIN PROGRAM PYTHON. import spss END PROGRAM. The above code invoke the following error: import spss END PROGRAM. >Error # 5712 in column 8. Text: spss >A valid IMPORT subcommand name is expected but not found. Recognized >subcommands are FILE, TYPE, KEEP, DROP, RENAME, and MAP. >Execution of this command stops. What could be the problem and how can I fix it? Thanks! |
In reply to this post by Chichi Shu
You didn't include the begin/end program
statements in your selection when you ran this, so the code was interpreted
as if it was Python syntax
Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: Chichi Shu <[hidden email]> To: [hidden email], Date: 01/17/2014 12:15 PM Subject: [SPSSX-L] Running Python scripts from SPSS Statistics Syntax Editor Sent by: "SPSSX(r) Discussion" <[hidden email]> Greeting, Listers, I have a python program which I have tried to run with SPSS Statistics in different ways. With SPSS Statistics client up and running, I’ve run the program by selecting File –> Open Script... , which invoked Python IDLE and shell. I then ran the program by clicking Utilities –> Run Script..., which doesn’t invoke Python IDLE or shell and operate on the IBM SPSS Statistics client. Lastly, I tried copying and pasting the code of the python program between BEGIN PROGRAM PYTHON. and END PROGRAM on SPSS Syntax editor. But this way doesn’t work for SPSS Statistics appears not to recognize the Python commands. For example, BEGIN PROGRAM PYTHON. import spss END PROGRAM. The above code invoke the following error: import spss END PROGRAM. >Error # 5712 in column 8. Text: spss >A valid IMPORT subcommand name is expected but not found. Recognized >subcommands are FILE, TYPE, KEEP, DROP, RENAME, and MAP. >Execution of this command stops. What could be the problem and how can I fix it? Thanks! |
This post was updated on .
In reply to this post by Chichi Shu
When ever I run the python code in SPSS Statistics Syntax Editor it works fine but when try to run the same python script as batch file but got the below error.
NameError: name 'spss' is not defined 176 0 END PROGRAM. 177 0 >Error # 5712 on line 176 in column 8. Text: spss >A valid IMPORT subcommand name is expected but not found. Recognized >subcommands are FILE, TYPE, KEEP, DROP, RENAME, and MAP. >Execution of this command stops. >Note # 214 on line 177. Command name: import >Due to an error, INSERT and INCLUDE file processing has been terminated and >the working file has been lost. You may either redefine your data or leave >SPSS Statistics. >Note # 236 >All outstanding macros have been terminated, all INSERT and INCLUDE processing >has been terminated, and all outstanding PRESERVE commands have been undone. I re-install SPSS Statistics 22 but still got the above error |
Administrator
|
Please define what you mean by running as a batch file!
From the FM:
"Scope and Limitations
•Programmatic variables created in a program block cannot be used outside of program blocks.
•Program blocks cannot be contained within DEFINE-!ENDDEFINE macro definitions.
•Program blocks can be contained in command syntax files run via the INSERT command, with the default SYNTAX=INTERACTIVE setting.
•Program blocks cannot be contained within command syntax files run via the INCLUDE command"
So I presume you are using INCLUDE?
Dr. Dr.
------
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
This post was updated on .
Hi David,
By batch file I mean .spj file. What you post help me alot. Basically I had change the default SYNTAX=INTERACTIVE to batch and it was creating problem. Now my problem is solved. Thank you so much. |
Free forum by Nabble | Edit this page |