08-12-2016 04:14 AM - edited 08-12-2016 04:16 AM
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:
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.
08-12-2016 12:08 PM
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.
08-15-2016 04:15 AM
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:
08-15-2016 06:38 PM
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.