Help using Base SAS procedures

SPSS Import - Too many Variables

Reply
Occasional Contributor SSG
Occasional Contributor
Posts: 12

SPSS Import - Too many Variables

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.

Super User
Posts: 10,550

Re: SPSS Import - Too many Variables

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.

Occasional Contributor SSG
Occasional Contributor
Posts: 12

Re: SPSS Import - Too many Variables

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;

Super User
Posts: 10,550

Re: SPSS Import - Too many Variables

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.

Occasional Contributor SSG
Occasional Contributor
Posts: 12

Re: SPSS Import - Too many Variables

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.

Super User
Posts: 10,550

Re: SPSS Import - Too many Variables

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.

Occasional Contributor SSG
Occasional Contributor
Posts: 12

Re: SPSS Import - Too many Variables

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!

Super User
Posts: 10,550

Re: SPSS Import - Too many Variables

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.

Ask a Question
Discussion stats
  • 7 replies
  • 527 views
  • 3 likes
  • 2 in conversation