Import SPSS data files into SAS Enterprise Guide

25


I'd love to believe that our loyal SAS customers never have to touch a statistical package from another company. Even as I work away in my comfy SAS bubble here in Cary, NC, I occasionally catch wind of stories about SAS customers who need to use data that comes from other products, such as SPSS, Stata, and even our own JMP.

Update 05Sep2013: There is now a new version of this task with more features. Check out the new and improved version described here.

Since version 9.1.3, SAS has supported an easy method to import these data files using the IMPORT procedure. With just a few lines of code and the help of our SAS/ACCESS to PC Files product, you can write a SAS program that slurps that data into a SAS data set. (You can use the EXPORT procedure to convert SAS data sets to these third-party formats too -- just in case you ever need that.)

To make it even easier for our SAS Enterprise Guide users, I built a set of simple tasks that you can use with SAS Enterprise Guide 4.1 -- no programming necessary. You can download the task here. (It's a ZIP file; use the README.txt instructions for simple installation.) When you install it and restart SAS Enterprise Guide, you'll see an additional three items in the Add-Ins menu: one for each of the supported file types: SPSS (.sav), JMP, and Stata (.dta) files.

The tasks are simple to use: you pick the file to import, and the task copies the file to your SAS server (if your SAS session is on a remote host) and then runs the IMPORT procedure. The resulting SAS data is stored in your WORK library, and the data and SAS log are both added to your project. (Note these requirements: you need at least SAS 9.1.3 with SAS/ACCESS to PC Files installed on your SAS machine.)

Try it out! And then please tell me how it goes by adding your comments back here on the blog.

By the way, these tasks are "baked in" for SAS Enterprise Guide 4.2, our forthcoming release, along with many other new tasks and features that I'll blog about soon.

Share

About Author

Chris Hemedinger

Senior Manager, SAS Online Communities

+Chris Hemedinger is the manager of SAS Online Communities. He's also co-author of the popular SAS for Dummies book, author of Custom Tasks for SAS Enterprise Guide using Microsoft .NET, and a frequent participant on the SAS Enterprise Guide discussion forum.

25 Comments

  1. Any chance we can get this functionality w/o needing SAS/ACCESS? I work in marketing research and 100% of our data comes in SPSS even though I work exclusively in SAS (and primarily in EG). I would use the import from SPSS every day, but wouldn't need all of the other stuff that comes with SAS/ACCESS, which is why my (small) business won't purchase it. (Note : there is no additional plug-in needed in SPSS to import or export SAS data.)

  2. Hi,

    I came across this page looking for information on converting sav and sps files to some usable form for JMP, since JMP doesn't recognize them in their original form. Can this be done? My PC does not have SPSS (hence my problem) or anything other stats software, only JMP.

    Thanks for your help.

  3. The SPSS conversion addin seems good, but still limited in ability. For instance how will I get the formats loaded? (The value labels that are available in SPSS). There is no point in just loading the data and having to spend a lot of time formatting the value labels.

    Thanks

    Vignesh

  4. use the following code to get the formats loaded (data value labels that are available in spss)
    proc format lib=libraryname cntlout=newsasdatasetname ;
    run;
    the data value labels that are available in spss are stored in the cntlout=new sas data set name

  5. rapidshare search on

    There is no point in just loading the data and having to spend a lot of time formatting the value labels.

  6. We tried to install this but recived an error "invalid object DNA". Refering to e support.sas.com/kb/41/583.html, we notice that the error was because we were running EG 4.2? Who should we approach to have this fixed?

  7. Ian, EG 4.2 and 4.3 have this feature built-in (Tasks->Data->Import SPSS Data). You don't need the custom task to make it work.

  8. Pingback: “Open in JMP” from SAS Enterprise Guide - The SAS Dummy

  9. Pingback: How do I export SAS to Excel files: Let me count the ways - The SAS Dummy

  10. I'm running EG 4.3 and so was able to import SPSS data via the task menu. However, when I tried to open the dataset, I got an error about a limit of 4096 formats or informats being exceeded in a single step. Is there a way to expand this limit?

    • Chris Hemedinger
      Chris Hemedinger on

      You can try to run a PROC DATASETS step on the imported data. For example, if the imported data is named WORK.CLASS:

      proc datasets lib=work memtype=data;
         modify class; 
         attrib _all_ format=;
      quit;
      • yes, that will remove all the formats. My questions was about the limit of 4096 and if it could be expaned. I really need some of the formats and so do not want to remove them all.

          • thanks for this. I was trying to ask about the 4096 limit and whether or not it could be expanded. Perhaps I should ask somewhere else. Could you recommend whom I should ask?

          • Chris Hemedinger
            Chris Hemedinger on

            Hildy, I think that the 4096 formats limit is an internal value that cannot be extended. However, you may be able to work around it by limiting the number of variables/formats that you reference in subsequent steps, after you import the SPSS file. You can limit the variables by using the DROP= or KEEP= data set option to include just the variables that you need for a given step.

            Beyond this, if you want to provide more specifics with code examples and perhaps some sample data, I recommend that you work with SAS Technical Support.

    • Chris Hemedinger
      Chris Hemedinger on

      Rafi, this task is built-in for SAS Enterprise Guide 5.1 (and has been since EG 4.2). You still need SAS/ACCESS to PC Files for the task to function, as it generated PROC IMPORT code for the SPSS file.

  11. I use EG 5.1 and I am able to import SPSS (.sav) files. However, some text fields are being truncated (length attribute is not being assigned correctly). Is there anyway to manipulate modify import procedure to assign the correct lenght of each field? Thanks in advance.

    • Chris Hemedinger
      Chris Hemedinger on

      I responded to Luis privately already, but I'll share this here: it appears that PROC IMPORT with SPSS does limit the character columns to a length of 255. A possible workaround is to use SPSS to export the data as CSV, then import the CSV using the File->Import Data task.

  12. Is there a slick way to right-click a dataset in EG 4.3 and export to Stata? I see various formats, but not Stata (or SPSS or JMP, for that matter). That would be great in Tasks->data->export...

  13. Pingback: New and improved: Importing SPSS data files in SAS Enterprise Guide - The SAS Dummy

Leave A Reply

Back to Top