bug when repeatedly open and close a dataset within a macro

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

bug when repeatedly open and close a dataset within a macro

la volta statistics

Hi all

 

I found a problem when I repeatedly open and close a dataset within a macro.

 

Here is some code for demonstration purposes only. I use the Employee data.sav that comes with SPSS which has 474 cases. The first part of the code is to generate dynamically 474 macro calls that get saved in the Temp1.sps.

The macro itself copies only the dataset named 'Original', makes a selection on the copied dataset (dataset named work), does a sort command, and closes the copied dataset again.

This works perfectly if you do only a few macro calls. However, when you run all 474 calls (by using the command INSERT  FILE = "D:\Temp\Temp1.sps".) the original dataset becomes empty after a while. Note: there is never a selection on the Dataset named 'Original'.

 

Can somebody repeat this bug?

I use SPSS 15 on a Windows XP platform.

 

Thank you in advance,

Christian

 

 

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

* Here the code:

* Sorry, it takes some 2 to 3 minutes to run the code.

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

 

DATASET CLOSE ALL.

NEW FILE.

 

GET

  FILE='C:\Programme\SPSS\Employee data.sav'.

DATASET NAME ORIGINAL.

 

Sort Cases By id.

 

DATASET DECLARE Sel.

AGGREGATE

  /OUTFILE='Sel'

  /BREAK=ID

  /N = N.

 

DATASET ACTIVATE Sel.

* Write Syntax.

Write Outfile  'C:\Temp\Temp1.sps' 

   /"!DoData Name = "Id".".

Exec.

 

DATASET CLOSE SEL.

 

DEFINE !DoData   (Name !TOKENS(1)).

 

DATASET ACTIVATE ORIGINAL.

 

DATASET Copy Work.

DATASET ACTIVATE Work.

 

 

Select if id = !Name.

 

Sort Cases by Id.

 

DATASET CLOSE Work.

DATASET ACTIVATE ORIGINAL.

 

!ENDDEFINE.

 

 

INSERT  FILE = "C:\Temp\Temp1.sps".

 

 

 

 

 

**********************************
la volta statistics

Christian Schmidhauser, Dr.phil.II
Weinbergstrasse 108
CH-8006 Zürich
Tel: +41 (043) 233 98 01
Fax: +41 (043) 233 98 02
email:
[hidden email] 
Web: www.lavolta.ch

 

Reply | Threaded
Open this post in threaded view
|

Re: bug when repeatedly open and close a dataset within a macro

Marks, Jim

Here is a suggestion:

 

Does changing the order of the dataset close / dataset open pairing make a difference?

 

DEFINE !DoData   (Name !TOKENS(1)).

 

DATASET ACTIVATE ORIGINAL.

 

DATASET Copy Work.

DATASET ACTIVATE Work.

 

 

Select if id = !Name.

 

Sort Cases by Id.

* change the order.

DATASET ACTIVATE ORIGINAL.

DATASET CLOSE Work.

 

!ENDDEFINE.

 

 

 

Jim Marks

Director, Market Research

x1616

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of la volta statistics
Sent: Thursday, October 15, 2009 10:06 AM
To: [hidden email]
Subject: bug when repeatedly open and close a dataset within a macro

 

Hi all

 

I found a problem when I repeatedly open and close a dataset within a macro.

 

Here is some code for demonstration purposes only. I use the Employee data.sav that comes with SPSS which has 474 cases. The first part of the code is to generate dynamically 474 macro calls that get saved in the Temp1.sps.

The macro itself copies only the dataset named 'Original', makes a selection on the copied dataset (dataset named work), does a sort command, and closes the copied dataset again.

This works perfectly if you do only a few macro calls. However, when you run all 474 calls (by using the command INSERT  FILE = "D:\Temp\Temp1.sps".) the original dataset becomes empty after a while. Note: there is never a selection on the Dataset named 'Original'.

 

Can somebody repeat this bug?

I use SPSS 15 on a Windows XP platform.

 

Thank you in advance,

Christian

 

 

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

* Here the code:

* Sorry, it takes some 2 to 3 minutes to run the code.

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

 

DATASET CLOSE ALL.

NEW FILE.

 

GET

  FILE='C:\Programme\SPSS\Employee data.sav'.

DATASET NAME ORIGINAL.

 

Sort Cases By id.

 

DATASET DECLARE Sel.

AGGREGATE

  /OUTFILE='Sel'

  /BREAK=ID

  /N = N.

 

DATASET ACTIVATE Sel.

* Write Syntax.

Write Outfile  'C:\Temp\Temp1.sps' 

   /"!DoData Name = "Id".".

Exec.

 

DATASET CLOSE SEL.

 

DEFINE !DoData   (Name !TOKENS(1)).

 

DATASET ACTIVATE ORIGINAL.

 

DATASET Copy Work.

DATASET ACTIVATE Work.

 

 

Select if id = !Name.

 

Sort Cases by Id.

 

DATASET CLOSE Work.

DATASET ACTIVATE ORIGINAL.

 

!ENDDEFINE.

 

 

INSERT  FILE = "C:\Temp\Temp1.sps".

 

 

 

 

 

**********************************
la volta statistics

Christian Schmidhauser, Dr.phil.II
Weinbergstrasse 108
CH-8006 Zürich
Tel: +41 (043) 233 98 01
Fax: +41 (043) 233 98 02
email:
[hidden email] 
Web: www.lavolta.ch

 

Reply | Threaded
Open this post in threaded view
|

AW: bug when repeatedly open and close a dataset within a macro

la volta statistics

Hi Jim

 

Thanks fort he suggestion. Unfortunately the order of the command did not change the behavior. It only makes that I get, after several correct rounds of copy and close, a warning in the output (Dataset Close: Unrecognized dataset name work. This command is not executed.). SPSS crashes then with the error message: The processor has terminated due to an unrecoverable error at 0x7c809e8a – fetching from 0x435c7374 and 'SPSS processor is unavailable' shows at the bottom of the SPSS Windows.

Apart the message not very much self explainable, I noticed that at the crash I had two dataset named Work: *Untitled 123[Work] and *Untitled 124[Work]. I have the feeling that after 123 rounds of closing the dataset named Work, SPSS fails to close correctly, resulting in the crash. The second try ended already after 16 rounds with the same output warning and a different error message:

Assertion failed!

Program: c:\PROGRA~1\spss\spssswin.exe

File: Z:\cs_source\ServerDataManger\svrdmitem.cpp

Line : 247

 

Expression: 0

 

 

I wonder if somebody can reproduce the failure.

 

Thanks anyway, Christian

 

 

**********************************
la volta statistics

Christian Schmidhauser, Dr.phil.II
Weinbergstrasse 108
C
H-8006 Zürich
Tel: +41 (043) 233 98 01
Fax: +41 (043) 233 98 02
email:
[hidden email] 
Web: www.lavolta.ch


Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von Marks, Jim
Gesendet: Donnerstag, 15. Oktober 2009 20:36
An: [hidden email]
Betreff: Re: bug when repeatedly open and close a dataset within a macro

 

Here is a suggestion:

 

Does changing the order of the dataset close / dataset open pairing make a difference?

 

DEFINE !DoData   (Name !TOKENS(1)).

 

DATASET ACTIVATE ORIGINAL.

 

DATASET Copy Work.

DATASET ACTIVATE Work.

 

 

Select if id = !Name.

 

Sort Cases by Id.

* change the order.

DATASET ACTIVATE ORIGINAL.

DATASET CLOSE Work.

 

!ENDDEFINE.

 

 

 

Jim Marks

Director, Market Research

x1616

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of la volta statistics
Sent: Thursday, October 15, 2009 10:06 AM
To: [hidden email]
Subject: bug when repeatedly open and close a dataset within a macro

 

Hi all

 

I found a problem when I repeatedly open and close a dataset within a macro.

 

Here is some code for demonstration purposes only. I use the Employee data.sav that comes with SPSS which has 474 cases. The first part of the code is to generate dynamically 474 macro calls that get saved in the Temp1.sps.

The macro itself copies only the dataset named 'Original', makes a selection on the copied dataset (dataset named work), does a sort command, and closes the copied dataset again.

This works perfectly if you do only a few macro calls. However, when you run all 474 calls (by using the command INSERT  FILE = "D:\Temp\Temp1.sps".) the original dataset becomes empty after a while. Note: there is never a selection on the Dataset named 'Original'.

 

Can somebody repeat this bug?

I use SPSS 15 on a Windows XP platform.

 

Thank you in advance,

Christian

 

 

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

* Here the code:

* Sorry, it takes some 2 to 3 minutes to run the code.

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

 

DATASET CLOSE ALL.

NEW FILE.

 

GET

  FILE='C:\Programme\SPSS\Employee data.sav'.

DATASET NAME ORIGINAL.

 

Sort Cases By id.

 

DATASET DECLARE Sel.

AGGREGATE

  /OUTFILE='Sel'

  /BREAK=ID

  /N = N.

 

DATASET ACTIVATE Sel.

* Write Syntax.

Write Outfile  'C:\Temp\Temp1.sps' 

   /"!DoData Name = "Id".".

Exec.

 

DATASET CLOSE SEL.

 

DEFINE !DoData   (Name !TOKENS(1)).

 

DATASET ACTIVATE ORIGINAL.

 

DATASET Copy Work.

DATASET ACTIVATE Work.

 

 

Select if id = !Name.

 

Sort Cases by Id.

 

DATASET CLOSE Work.

DATASET ACTIVATE ORIGINAL.

 

!ENDDEFINE.

 

 

INSERT  FILE = "C:\Temp\Temp1.sps".

 

 

 

 

 

**********************************
la volta statistics

Christian Schmidhauser, Dr.phil.II
Weinbergstrasse 108
CH-8006 Zürich
Tel: +41 (043) 233 98 01
Fax: +41 (043) 233 98 02
email:
[hidden email] 
Web: www.lavolta.ch

 

Reply | Threaded
Open this post in threaded view
|

Re: bug when repeatedly open and close a dataset within a macro

djhurio
In reply to this post by Marks, Jim