SPSS Statistics

 View Only

 Make SPSS Window Opened even after Closing the Data File

Jakov Smith's profile image
Jakov Smith posted Fri June 20, 2025 02:49 AM

Hi,

I using SPSS v27, SPSS always requires at least one data file to be opened, otherwise it will close when you close the data file, although syntax and output window are still opened.

I often made a statistics though syntax window, so how to make syntax window remains opened even after closing the data file?

Thanks

Gunilla Rudander's profile image
Gunilla Rudander

Hi Jakov,
As you have seen it must always be at least one dataset or an empty data window open, otherwise the whole SPSS program will be closed.
If your dataset name is Dataset1 and you want to close it, without closing the whole SPSS program, you could add this lines of syntax codes in the syntax window. (It will open a new dataset that will get the name "empty" (you can choose another name if you want).

NEW FILE. 
DATASET NAME empty WINDOW=FRONT.
DATASET CLOSE DataSet1.

Chris Keran's profile image
Chris Keran

Or with SPSS closed, just open an existing .sps (syntax) file and then you'll have an open syntax file and an empty data file.

FYI, I only open SPSS by double-clicking on an existing .sps file.

Jon Peck's profile image
Jon Peck IBM Champion

I am wondering why this is an issue.  If you minimize the Data Editor window rather than closing the file, why is that not a satisfactory way to work?

Jakov Smith's profile image
Jakov Smith

Gunilla Rudander, Chris Keran, and Jon Peck

Thanks for your reply

I always make edits on the Excel file of my data, then import it through syntax and make analyses, so I want to apply data analyses to last edit of imported data without putting (Dataset Activate) each time in syntax.

However, I want to know why SPSS doesn't consider syntax or output window as window like data window? it's not good idea in software world.

Thanks

Chris Keran's profile image
Chris Keran

If I understand your ask, I recommend opening an SPSS session by opening your .sps file and then just run your syntax. Here is an example without needing to use Dataset Activate:

*Get the Audited member data - Calendar year.
GET DATA
  /TYPE=XLSX
  /FILE='K:\CEA\MI\CURRENT PROJECTS\DATA\\YE 2024 Audited Members Updated.xlsx'
  /SHEET=name 'Calendar Year 2024'
  /CELLRANGE=FULL
  /READNAMES=ON
  /DATATYPEMIN PERCENTAGE=95.0
  /HIDDEN IGNORE=YES.
EXECUTE.
ALTER TYPE Member_Type_Full (A26).
ALTER TYPE US_State(A11).
SORT CASES ID.
SAVE OUTFILE='K:\CEA\MI\CURRENT PROJECTS\DATA\\CalendarYearMembers.sav'
  /COMPRESSED.

Jakov Smith's profile image
Jakov Smith

Thanks Chris Keran,

I have full an  .sps file

My routine work, importing the data >>> make analyses>>> if data need adjustment>>> close the data file>>> make edits on excel file >>>> import again and so on.

However, take your time as my option is not possible in SPSS

Best Regards

Jon Peck's profile image
Jon Peck IBM Champion

The DE window is different from the other types, because it is closely tied to the SPSS backend process and always reflects what the backend is doing to the data.  So if the backend goes away, I.e., closes, the DE is left stranded.  Normally, it is listening for backend data actions.  While the Viewer window is also connected to the backend, it just processes the queue of output items sent by the backend.  And the Syntax window just sends commands to the backend work queue.

I don't see why having the DE stick around is a problem, but you might find the SPSS project extension command to be useful.  You can install it via Extensions > Extension Hub.  Then look at the dialog box orcsyntax help for it.  It can automateca lot of setup tasks either when SPSS starts orcwhen the command is run.

Suharto Anggono's profile image
Suharto Anggono

In Options (Edit > Options...), in General tab, there is "Open only one dataset at a time". If it is checked, if you import data by using the menus and dialog boxes again, the new one will replace the previous one. You can also paste the syntax.

Alternatively (no need to check "Open only one dataset at a time" option), if you import data by using syntax, just remove DATASET command(s) (DATASET NAME, DATASET ACTIVATE) in your syntax. The active dataset will be unnamed. If you import again, the new one will replace the previous unnamed dataset.

Jakov Smith's profile image
Jakov Smith

Thanks all for your help

Best Regards