It's been almost 5 years since I posted one of the first custom tasks for SAS Enterprise Guide. It was a task that made it easier to convert SPSS data files into SAS data sets.
Like many projects that begin as custom tasks, this one later became a feature in the product. Since SAS Enterprise Guide 4.2, the "Import SPSS File" task has appeared on the Data menu (along with Import JMP File and Import Stata File).
As a few readers observed, the task is limited because it ignores some of the nuances of SPSS data files. For example, SPSS data files can feature value labels, which are similar in concept to SAS formats. A value label maps a raw data value (such as 1 or 0) to a formatted display value (such a 'Male' or 'Female'). In SAS, it's a user-defined format that contain the rules to map data for display or grouping purposes. Also, the current task stores the imported data in the temporary WORK library; if you want to place it in a permanent location, you need to add another step in the process.
In response to customer requests, we've built a new version of the task that provides more control and some new options. Consider using this new task when:
- You want to store the imported data in a permanent SAS library, not just in the temporary WORK library. The new version of the task allows you to select any SAS library that you have defined.
- The SPSS data file contains value label definitions that you want to keep with the data going forward. During the import process, SAS converts SPSS value labels into user-defined SAS formats. These formats are stored in a secondary file called a SAS catalog, which must remain available for use the next time you open your new data in SAS. The new version of the task provides more options for managing these SAS formats.
How do you know whether your SPSS data files contain value labels? When you import an SPSS data file, review the results in the SAS Enterprise Guide data grid. When you see a numeric column (indicated with a blue circle icon) that displays character values, then you know that there is a SAS format at work.
The "giveaway" is the blue circle icon near the column name, as well as the tooltip that appears when you hover the mouse pointer over the column. Despite the fact that the column type is numeric, the displayed values are "female" and "male".
Downloading and using the new task
NOTE: If you have SAS Enterprise Guide 6.1 or later, this new version of the task is built in and replaces the older version of the task. You do not need to download/install anything additional! If you're working with SAS Enterprise Guide 5.1 or earlier, then read on...
The new version of the task is built to work with SAS Enterprise Guide 5.1 and later. Like the previous version, this task requires that you have SAS/ACCESS to PC Files installed with SAS, as it still uses PROC IMPORT to convert the SPSS file to a SAS data set. The task imports SPSS .SAV files. You can download the new custom task from here:
>> Download task: Import SPSS data and value labels
The task package is a ZIP archive that contains a DLL and documentation about how to install and use it. (And don't forget this trick for installing if it doesn't work right away.)
Once you have it installed, you'll see the task in Tools->Add-Ins->Import SPSS data and value labels. It does not replace the Import SPSS File task that is already in the Data menu; this is a new task. Here's a preview of the task window:
As always, let me know what you think of the task and whether you find it useful.
1 Comment
Pingback: Import SPSS data files into SAS Enterprise Guide - The SAS Dummy