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:
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
What about DBMS=SPSS?
Thanks for replying Reeza!
I have now tried with DBMS=SPSS and the problem is still there unfortunately
Can you provide more info on the error that you are getting in the log...
There are no errors
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.
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 _=¾"
I think it may be worth it to contact SAS Tech Support.
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.
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!
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.
Ready to level-up your skills? Choose your own adventure.