|
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 DATASET CLOSE
Work. DATASET ACTIVATE ORIGINAL. !ENDDEFINE. INSERT FILE = "C:\Temp\Temp1.sps". ********************************** Christian Schmidhauser, Dr.phil.II |
|
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 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". **********************************
Christian
Schmidhauser, Dr.phil.II |
|
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 **********************************
Christian
Schmidhauser, Dr.phil.II Von: SPSSX(r)
Discussion [mailto:[hidden email]] Im
Auftrag von 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 * 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 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 DATASET CLOSE
Work. DATASET ACTIVATE ORIGINAL. !ENDDEFINE. INSERT FILE =
"C:\Temp\Temp1.sps". ********************************** Christian Schmidhauser, Dr.phil.II |
|
In reply to this post by Marks, Jim
Runs fine on PASW Statistics 17.0.3.
|
| Free forum by Nabble | Edit this page |
