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

I am running SAS 9.3 trying to import an SPSS file using the following SAS syntax:

PROC IMPORT OUT= WORK.StuEmp_raw

            DATAFILE= "L:\Student Employment\Data\IUPUI_Student_Employee_Survey_raw.sav"

            DBMS=SPSS REPLACE;RUN;

This SPSS file contains several String (Character) variables with a length of about 2,000.  This should be well within what a character variable in SAS can handle.  However, SAS is still breaking the text fields into multiple character variables with a length of $255 (i.e. the default).  I could dump the SPSS file into a .csv, but I'd like to maintain the labels on some other variables in the file. How can I specify the length of character variables when importing from SPSS?  Will I need to do a data step_ 

1 REPLY 1
ballardw
Super User

One approach might be:

Import as you have, modify settings like length and drop the multiple text bits for single variables. Save as a 0 observations data set.

Then import a CSV and append to the previous.

Or try accessing the SAV file using the libname statement instead of Proc Import.

If I had access to SPSS I would see about exporting to SAS from there. The last time I was working with SPSS one option would export the value labels as a SAS format for use as well.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1574 views
  • 1 like
  • 2 in conversation