BookmarkSubscribeRSS Feed
Flun
Calcite | Level 5

Hello!

 

I'm looking for a way to get usable value/label pairs when using proc export to export datasets to spss dataset files (.sav). The formats are taken from our standard format catalog to using the fmtlib option. This produces good results when looking at the resulting dataset in SPSS - but only for both numeric values and strings with only numbers like "01". When the value is a string with characters, I get extraneous spaces and unwanted symbols added at the end of the value, like so:

 

clip.PNG

 

Code:

proc export data=data
outfile="path\file.sav"
dbms=sav replace;
fmtlib=FORMATS.FORMATS;
run;

 

Grateful for any ideas I can try to make this work.

 

Regards

Fredrik

 

8 REPLIES 8
Reeza
Super User

What about DBMS=SPSS?

Flun
Calcite | Level 5

Thanks for replying Reeza!

I have now tried with DBMS=SPSS and the problem is still there unfortunately

DMoovendhan
Quartz | Level 8

Can you provide more info on the error that you are getting in the log...

Flun
Calcite | Level 5

There are no errors

ballardw
Super User

You say that you " get extraneous spaces and unwanted symbols added at the end of the value". Do you mean at the begining of the line? I don't see anything at the end in the displayed picture.

 

I am wondering if there might be an encoding issue involved, such as a UTF-8 to UTF-16 between the two programs.

 

 

Flun
Calcite | Level 5

It does seem like an ecoding problem.

What I've tried so far is to set the encoding for file I want proc export to write to. I tried with using a filename statement and defining a .sav file with utf-8 encoding, before the proc export. SAS does create a .sav-file but then no data seems to be written to that file (no errors though).

 

ballardw: Look at the picture again. the values look like this:

"Value1     _=¾"

Reeza
Super User

I think it may be worth it to contact SAS Tech Support. 

ballardw
Super User

I think we are using END different context and I haven't looked at SPSS code in so long I don't remember the proper appearance for a Value statement.

 

If tech support can't help it may be easier to write some SPSS syntax from the SAS Data and/or format information that can be pasted into SPSS after opening the data set.

It has been long enough (more than 10 years) since I had to deal with SPSS so I don't think I can make a more specific suggestion.

If some of the SAS values are from formats then you might start with creating a CNTLOUT data set from the format libray involved.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 8 replies
  • 5743 views
  • 2 likes
  • 4 in conversation