1

I am writing out statistical results in SPSS with code like

OMS 
   / SELECT Tables Headings
   / DESTINATION FORMAT = OXML OUTFILE='C:\Temp\outfile.xml'.

The syntax file is saved as UTF-8 (with bookmark). It has some words with umlauts (german funny characters like ä, ö, ü). When I open the syntax file, it displays these umlauts as ü, ö etc. Needless to say, in the output xml file, the umlauts are still garbled.

How can I specify what encoding the syntax file is in? The bookmark (BOM) does not seem to be doing the trick.

If not, what encoding should I use for the syntax file?

Daren Thomas
  • 67,947
  • 40
  • 154
  • 200

2 Answers2

2

This works for me (SPSS 20):

DATASET CLOSE ALL.
NEW FILE.
SET UNICODE = OFF.

OR:

DATASET CLOSE ALL.
NEW FILE.
SET UNICODE = ON.

In fact, the first two lines are just to make sure that no dataset is opened, as this would prevent the command from being executed.

  • If you place a a `PRESERVE.` command before the block, and after all syntax is done run `RESTORE.` (after the dataset close + new file) it will restore the unicode settings to their previous state. – Andy W Jun 13 '14 at 12:29
1

This worked:

SET UNICODE YES

(at the top of the syntax file)

NOTE: This setting is "sticky", i.e. it persists until you change it again for all SPSS sessions on that computer. Not so nice, but I guess it will do...

Daren Thomas
  • 67,947
  • 40
  • 154
  • 200
  • I get an error saying I can't run the unicode command as long as datasets are open but the dataset has to be open in order to run the syntax :o – markus Nov 04 '13 at 13:16
  • @markus, I'm sorry, I haven't had access to SPSS for years now and cannot help you. But maybe someone else will see this? Otherwise you might have better luck creating a separate question... – Daren Thomas Nov 05 '13 at 09:28