SPSS Statistics

 View Only

Old Code Rusts - an Updated Extension Command

By Jon Peck posted Mon October 10, 2022 03:42 PM

  

In 2008, I wrote the GATHERMD extension command for SPSS Statistics.  It was one of the first such commands.  It got an update in 2009 to enable language translation, but it had not been touched until this month (October, 2022) except in the bulk conversion from Python 2 to Python 3 a few years ago when Python 2 reached the end of its lifetime and was removed from Statistics. 

The command can be pretty useful, but you wouldn’t guess that from its name.  It scans an entire directory tree looking for data files of selected types and builds a dataset of file names, variable names, and variable labels.  So, it can be pretty useful in keeping track of your datasets.

The command still works, but it needed a refresh.  First, the name: it needed a more descriptive name and needed to follow the subsequently developed convention for how to name extension commands.  The new name is STATS MAKE CATALOG (File > Make Variable Catalog).  It also needed upgrading to the newer form of custom dialogs that was introduced in Statistics version 24.  (The current version is 29).

It was developed before the high compression sav file format, zsav, was developed, so it didn’t support that file type, and there was a missing SAS file type.  These are all supported in the SPSS syntax used in the command, but they were not accessible to it.  It didn’t support the SPSS Portable File format, which is still supported but rarely used anymore, but there may be old data files in it.

Finally, it seemed to me that it would be useful to allow a filter on variable names recorded.  If you are just trying to find all the data you have on age or education, for example, you probably don’t want all the other variables to be listed.  I added a regular expression on the variable names as an option.

The file filter specification already is interpreted as a regular expression, so to get the most use out of this extension, it helps to understand how to write one.  Regex’s can be very complicated, but most of the time a simple regex will do the job.  The dialog and syntax help for the new version have some examples and references on this.

So, this post serves two purposes: it announces the new, improved version, which is available via the Extensions > Extension Hub menu in Statistics, and it is a reminder that even working old code can use an overhaul now and then.


#SPSSStatistics
0 comments
8 views

Permalink