BookmarkSubscribeRSS Feed
SSG
Fluorite | Level 6 SSG
Fluorite | Level 6

I am trying to import an SPSS file into SAS using Proc Import with DBMS=SPSS replace.  The SPSS file has 394 variables.  However, when I try to import it, the SAS file reads 8,458 variables, most of which are empty columns.  Here's what it looks like in Viewtable.

SAS screenshot.jpg

The variable with the name "Subunit" is H_1 in my SPSS dataset, so the subsequent "Subunits" are imported as H_1A, H_1B, etc.  How can I import this file and still preserve the formatting from SPSS.

Thanks!

P.S.

This SPSS file was created using Class Climate from Pearson, if that matters.

7 REPLIES 7
ballardw
Super User

Which OS are you running? Which OS created the file? I'm not sure that different OS versions of SPSS would be exactly the same any you may be crosswise with this.

Also post the code you used to import so we could see if any options we'd suggest were already used.

SPSS does provide a format for cross-platform interchange. It may be that's what you need.

Also check your documentation as to which version of SPSS files you can read with SAS and which version created the file. A newer version of SPSS may be needed to save "backwards' to an older version SAS can read.

SSG
Fluorite | Level 6 SSG
Fluorite | Level 6

I'm running Windows 7 Enterprise (64-bit).  Not sure about the computer that created the file. It was automatically generated from an online survey system, downloaded by a colleague, then sent to me.  I'll ask about how those files are generated. I'm running SPSS 22, but I'm not having any problems uploading any SPSS files I have created myself.

I didn't do anything fancy with the code, just the basics:

PROC IMPORT OUT= work.Mensswd_14

            DATAFILE= "G:\IMIRDATA\AllSurveys\Athletic Department surveys\End of season reports\2014-Winter-Spring-RawData\Basketball and Swimming and Diving\Mens-Swimming and Diving-Winter-2013-RawData.sav"

            DBMS=SPSS REPLACE;RUN;

ballardw
Super User

If you have SPSS I would try opening it with that and see if you get any interesting behaviors. Then save the data to a new file to import into SAS.

SSG
Fluorite | Level 6 SSG
Fluorite | Level 6

Everything was fine when I opened the file in SPSS.  I tried saving it again in SPSS 7 and then uploading to SAS; same result.

ballardw
Super User

Take a close look at text fields in SPSS, especially if one of them was and open entry. It may be that there is some encoding issue or something getting interpreted oddly. I don't know if odd characters in a variable label might cause issues. Or maybe in inclusion of an image??

Or export the data from SPSS to CSV, I know you'll loose some info but it may let you find if there is a problematic field.

SSG
Fluorite | Level 6 SSG
Fluorite | Level 6

Thanks.  I exported to a .csv and it looks like it will be OK.  I wanted to keep the coding though, so I just imported the file and dropped the extra variables. 

Thanks so much, you've been a huge help!

ballardw
Super User

It has been a long time since I worked with SPSS but I know that the last version had an export to SAS feature that allowed it to create SAS Proc Format code to generate value labels and I think the variable labels came across as well with the limits on SAS labels. If the data had the entire question, and possibly response choices, as the variable label then the length likely exceeds SAS label limits but would be a start.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 2044 views
  • 3 likes
  • 2 in conversation