0
votes

I have a data set consisting of variables id, condition, response. I have the following syntax to generate an Excel file, say, for data cleaning:

compute tab=9.
formats tab (pib).
write outfile='Directory\outfile.xls' / " if id = " tab id tab " and condition = " tab condition tab " response = ". 
execute.

The variable tab is created to separate the outputs (text, variables) in the write outfile command into different cells in Excel file. I run the syntax on one computer (SPSS 23, 64-bit) and it works as expected, like this:

|if id = | 1 | and condition = | 2 |response =|

Each | represent a cell.

However, I run on another computer (SPSS 23, 32-bit) and it doesn't work. It particular, it dumps all fields from the write outfile into one single cell. It looks like this

|if id = 1 and condition = 2 response =|

Can you tell what may go wrong? I suspect it has something to do with variable tab. And what does pib format mean?

UPDATE: I try to write outfile in text format and the tab works OK.

write outfile='Directory\outfile.txt' / " if id = " tab id tab " and condition = " tab condition tab " response = ".
1

1 Answers

1
votes

The WRITE command is always creating a text file regardless of the file extension. (SAVE TRANSLATE could create Excel files directly.). So the difference may be on the Excel side. Looking at the WRITE output as a hex dump would show for sure what is being written.

PIB format stands for Positive Integer Binary. It is used here to say to treat 9 as a character code rather than the numeric value 9. 9 is the character code for a tab.