BookmarkSubscribeRSS Feed
montgomerybarre
Obsidian | Level 7
Getting an encoding error when importing an SPSS (.SAV) dataset that I can not figure out how to solve.

Code and Log:
options MSGLEVEL=I;
proc import datafile= &originalfile
dbms=sav out=x replace;
run;
NOTE: VARCHAR data type is not supported by the V9 engine. Variable ID has been converted to CHAR data type.
NOTE: VARCHAR data type is not supported by the V9 engine. Variable STUDY has been converted to CHAR data type.
When I look at a print of the data, the problem becomes clear: there is some encoding error happening that is messing up the line feed. The first observation of data looks correct, but the second observation has an empty value for ID (first character variable), and the first numeric variable (age) is 6.0134E-154 instead of a normal age in the first observation, like 19, and the person's age looks like it's showing up in the next numeric variable. This pattern continues through the next observation, so that the plausible age keeps moving over to the next variable, creating a diagonal down and to the right pattern of where age is. Hopefully that makes sense, would be easier to show, but the data is confidential.

So this is an issue of encoding mismatch causing a line feed error, however I can find no information online as to how to force the dataset (which, remember, is a .sav not a sas7bdat) and the SAS session to have the same encoding.

Does anyone have any ideas how to solve this?
1 REPLY 1
Tom
Super User Tom
Super User

PROC IMPORT spits out that bogus "warning" about VARCHAR data types in other places.  You can ignore it. So that message is probably NOT related to the problem you are having.

 

What version of SPSS made the file?  Was it using UTF-8 characters (does that version of SPSS even support UTF-8 characters?)

 

What encoding is your SAS session using? Is it using UTF-8? Or some single byte encoding instead?

 

How did you move the SAV file from the machine that made it to the machine were SAS is tried to read it?  Is it possible you copied the file as TEXT file instead of a BINARY file and corrupted the content?  That used to be a common problem when moving files with FTP.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 303 views
  • 0 likes
  • 2 in conversation