Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Mathematics
General TopicsResearchOperations ResearchStatisticsMathematical LogicNumerical AnalysisUndergraduate MathAlgebra HelpRecreational Math
Math Software
MapleMathematicaMATLABScilabSASSPSS

Math Forum / Math Software / SPSS / October 2008



Tip: Looking for answers? Try searching our database.

ERRORS #6844 AND #1

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
A.A.A - 05 Oct 2008 17:46 GMT
Hi,

I got the following errors:

>Error # 6844 in column 256.  Text: (End of Command)
>The end of a macro expression occurred when an operator was expected.
>This command not executed.

>Error # 6844 in column 256.  Text: (End of Command)
>The end of a macro expression occurred when an operator was expected.

>Error # 1.  Command name: !aya
>The first word in the line is not recognized as an SPSS command.
>This command not executed.

When running the following SPSS syntax:

Define !aya().

OMS SELECT TABLES/IF SUBTYPE='Parameter Estimates' /DESTINATION
FORMAT=SAV NUMBERED = model
OUTFILE='H:\results\2mMLEdCOEFF.sav'.

OMS SELECT TABLES/IF SUBTYPE='classification'/DESTINATION FORMAT=SAV
NUMBERED = model
OUTFILE='H:\results\2mMLEdCLASS.sav'.

!do !i=1 !to 1.
GET DATA
/TYPE=XLS
/FILE=!Quote(!concat('E:\s\', '2datad', !i, '.xls'))
/SHEET=name 'Sheet1'
/CELLRANGE=full
/READNAMES=on
/ASSUMEDSTRWIDTH=32767.

*saving the file after droping unwanted columns, then loading the new
file.
***************************************************************************­
*.

SAVE OUTFILE= !quote(!concat('E:\work\', '2datad', !i, '.sav'))
/DROP=V1 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 /COMPRESSED.

GET
FILE= !quote(!concat('E:\work\', '2datad', !i, '.sav')).

RECODE
 @1 @2  (1=2)  (0=3)  .
EXECUTE .

SAVE OUTFILE= !quote(!concat('f:\recoded\', '2recdatad', !i, '.sav').

GET
FILE= !quote(!concat('f:\recoded\', '2recdatad', !i, '.sav').

*Performing multinomial logistic regression.

*******************************************.

NOMREG
 V14  (BASE=FIRST ORDER=ASCENDING) BY @1 @2
 /CRITERIA CIN(95) DELTA(0) MXITER(100) MXSTEP(5) CHKSEP(20)
LCONVERGE(0) PCONVERGE(0.000001)

SINGULAR(0.00000001)
 /MODEL
 /STEPWISE = PIN(.05) POUT(0.1) MINEFFECT(0) RULE(SINGLE)
ENTRYMETHOD(LR) REMOVALMETHOD(LR)
 /INTERCEPT =INCLUDE
 /PRINT = CLASSTABLE PARAMETER SUMMARY LRT CPS STEP MFI .

!doend.
OMSEND.

GET FILE='H:\results\2mMLEdCOEFF.sav'.
SELECT IF(Var2='Intercept'or Var2='[@1=2]'or Var2='[@2=2]').
EXE.
DELETE VARIABLES Command_ Subtype_ label_  Std.Error Wald dF
Sig ExpB lowerBound UpperBound.
SAVE OUTFILE = 'H:\results\2mMLEdCOEFF.sav'.
MATCH FILES FILE='H:\results\try.sav'/file='H:\results
\2mMLEdCOEFF.sav'/BY model Var1.
SAVE OUTFILE = 'H:\results\2mMLEdCOEFF.sav'.

GET FILE='H:\results\2mMLEdCLASS.sav'.
SELECT IF(Var1='Overall Percentage').
EXE.
DELETE VARIABLES Command_ TO @3.
SAVE OUTFILE='H:\results\2mMLEdCLASS.sav'.

Get file='H:\results\2mMLEdCOEFF.sav'.
SAVE TRANSLATE OUTFILE='H:\results\2mMLEdCOEFF.XLS'
/TYPE=XLS
/VERSION=8
/KEEP=ALL
/FIELDNAMES.

Get file='H:\results\2mMLEdCLASS.sav'.
SAVE TRANSLATE OUTFILE='H:\results\2mMLEdCLASS.XLS'
/TYPE=XLS
/VERSION=8
/KEEP=ALL
/FIELDNAMES.

!Enddefine.
!aya.

Could anyone help with fixing these errors?

thanks,
A.S
Bruce Weaver - 05 Oct 2008 18:18 GMT
> Hi,
>
[quoted text clipped - 67 lines]
>   /INTERCEPT =INCLUDE
>   /PRINT = CLASSTABLE PARAMETER SUMMARY LRT CPS STEP MFI .

--- snip ---

That blank line in the middle of the NOMREG command will cause a
problem.  I expect you are getting an error when attempting to
define the macro, and that's why you get the error (not
recognized) when you try to run it.

Signature

Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."

A.A.A - 05 Oct 2008 23:33 GMT
> > Hi,
>
[quoted text clipped - 81 lines]
>
> - Show quoted text -

Hi,

I removed the blank,but this did not remove the problem. I noticed
that when i removed:

RECODE
 @1 @2  (1=2)  (0=3)  .
EXECUTE .
SAVE OUTFILE= !quote(!concat('f:\recoded\', '2recdatad', !i, '.sav').
GET
FILE= !quote(!concat('f:\recoded\', '2recdatad', !i, '.sav').

from the syntax,the errors disappeared.But in my syntax,i need the
part i removed. i do not know why this part is causing errors?. I do
not understand also what do you mean by"I expect you are getting an
error when attempting to define the macro, and that's why you get the
error (not
recognized) when you try to run it." what could i do to fix this?

Thanks,
Waiting for your reply,
A.A.A
Bruce Weaver - 06 Oct 2008 01:03 GMT
>> That blank line in the middle of the NOMREG command will cause a
>> problem.  I expect you are getting an error when attempting to
[quoted text clipped - 4 lines]
>
> I removed the blank,but this did not remove the problem.

It might not have removed all the problems, but having a blank
line in the middle of a command will cause an error.

> I noticed
> that when i removed:
[quoted text clipped - 5 lines]
> GET
> FILE= !quote(!concat('f:\recoded\', '2recdatad', !i, '.sav').

So you don't know if the problem is the RECODE, the SAVE, or the
GET.  To pin it down, try removing those commands one at a time.

Why are you saving so many versions of the data, by the way?  If
all you really want is the tables of coefficients and the
classification tables, there is no real need to be saving all
those other files.

> from the syntax,the errors disappeared.But in my syntax,i need the
> part i removed. i do not know why this part is causing errors?. I do
> not understand also what do you mean by"I expect you are getting an
> error when attempting to define the macro, and that's why you get the
> error (not
> recognized) when you try to run it." what could i do to fix this?

What I meant was that the blank line in the middle of NOMREG would
cause an error.  That would cause the macro !aya to not be
defined.  So when you attempt to run it, SPSS does not recognize
it, and you get another error.

Here's another tip:  When you are trying to figure out where
errors are occurring in a macro, turn MPRINT on before running the
macro.  E.g.,

SET MPRINT ON.
!aya .
SET MPPRINT OFF.

> Thanks,
> Waiting for your reply,
> A.A.A

Signature

Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."

fred.sutton@lsc.gov.uk - 06 Oct 2008 08:54 GMT
I would agree with Bruce that you need to turn mprints on, it really
does help sort out errors, but after a quick shufty, in the lines

SAVE OUTFILE= !quote(!concat('f:\recoded\', '2recdatad', !i, '.sav').
GET
FILE= !quote(!concat('f:\recoded\', '2recdatad', !i, '.sav').

For starters you have unbalanced brackets, two left and only one
right, and you would be better off indenting the second lines, or
putting the GET and the FILE on the same line.

> >> That blank line in the middle of the NOMREG command will cause a
> >> problem.  I expect you are getting an error when attempting to
[quoted text clipped - 54 lines]
> bwea...@lakeheadu.cahttp://sites.google.com/a/lakeheadu.ca/bweaver/
> "When all else fails, RTFM."
Bruce Weaver - 06 Oct 2008 14:29 GMT
On Oct 6, 3:54 am, fred.sut...@lsc.gov.uk wrote:
> I would agree with Bruce that you need to turn mprints on, it really
> does help sort out errors, but after a quick shufty, in the lines
[quoted text clipped - 6 lines]
> right, and you would be better off indenting the second lines, or
> putting the GET and the FILE on the same line.

Good catch, Fred.  And thanks for introducing me to the word
"shufty" (also "shufti").  That's one I did not pick up when I was in
the UK.  ;-)

For the benefit of others who may not know what it means, see the
first 2 definitions here:

 http://www.urbandictionary.com/define.php?term=shufty

--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."
Bruce Weaver - 06 Oct 2008 18:17 GMT
> Hi,
>
[quoted text clipped - 106 lines]
> thanks,
> A.S

This is more of a general comment than a specific response to your
queries.  I find myself wondering why youhave so many SAVE OUTFILE and
GET FILE commands in that macro.  Unless you have some specific need
for the file of coefficients (with and without the recodes) later on,
why not simplify your macro a bit, like this:

Define !aya().

OMS SELECT TABLES/IF SUBTYPE='Parameter Estimates' /
DESTINATION FORMAT=SAV NUMBERED = model
OUTFILE='H:\results\2mMLEdCOEFF.sav'.

OMS SELECT TABLES/IF SUBTYPE='classification'/
DESTINATION FORMAT=SAV NUMBERED = model
OUTFILE='H:\results\2mMLEdCLASS.sav'.

!do !i=1 !to 1.
GET DATA
/TYPE=XLS
/FILE=!Quote(!concat('E:\s\', '2datad', !i, '.xls'))
/SHEET=name 'Sheet1'
/CELLRANGE=full
/READNAMES=on
/ASSUMEDSTRWIDTH=32767.

* The OP saved the data to a .SAV file at this point.
* But unless there is some specific need for that
* file later on (unrelated to this macro), there
* is no need to save the data--it's available in
* the original Excel file.
* Likewise, there is no need for the GET FILE command
* that was in the OP's macro.

RECODE
 @1 @2  (1=2)  (0=3)  .
EXECUTE .

* The OP data again--but there is no need for that.

*Performing multinomial logistic regression.
*******************************************.

NOMREG
 V14  (BASE=FIRST ORDER=ASCENDING) BY @1 @2
 /CRITERIA CIN(95) DELTA(0) MXITER(100) MXSTEP(5) CHKSEP(20)
  LCONVERGE(0) PCONVERGE(0.000001) SINGULAR(0.00000001)
 /MODEL
 /STEPWISE = PIN(.05) POUT(0.1) MINEFFECT(0) RULE(SINGLE)
  ENTRYMETHOD(LR) REMOVALMETHOD(LR)
 /INTERCEPT =INCLUDE
 /PRINT = CLASSTABLE PARAMETER SUMMARY LRT CPS STEP MFI .

!doend.
OMSEND.

* Open file of coefficients, keeping only needed variables and rows.

GET FILE='H:\results\2mMLEdCOEFF.sav' /
DROP = Command_ Subtype_ label_  Std.Error Wald dF
       Sig ExpB lowerBound UpperBound.
SELECT IF(Var2='Intercept'or Var2='[@1=2]'or Var2='[@2=2]').
EXE.

* Merge with file TRY.SAV .

MATCH FILES
FILE='H:\results\try.sav'/
file = * /
BY model Var1 .
EXE.

* Save file to .SAV and .XLS formats.

SAVE OUTFILE = 'H:\results\2mMLEdCOEFF.sav'.
SAVE TRANSLATE OUTFILE='H:\results\2mMLEdCOEFF.XLS'
/TYPE=XLS
/VERSION=8
/KEEP=ALL
/FIELDNAMES.

* Open file of classification tables, keeping only needed variables &
rows.

GET FILE='H:\results\2mMLEdCLASS.sav' /
DROP = Command_ TO @3.
SELECT IF(Var1='Overall Percentage').
EXE.

* Save file to .SAV and .XLS formats.

SAVE OUTFILE='H:\results\2mMLEdCLASS.sav'.
Get file='H:\results\2mMLEdCLASS.sav'.
SAVE TRANSLATE OUTFILE='H:\results\2mMLEdCLASS.XLS'
/TYPE=XLS
/VERSION=8
/KEEP=ALL
/FIELDNAMES.

!Enddefine.

* Call the macro (with MPRINT on when testing .

set mprint on. /* Can be removed after testing .
!aya.
set mprint off.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.