1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Solution ID:	 	100009718	
Product:	 	SPSS Base 	
Version:	 	10.0	
 		
Question Type:	 	Data Import-Export	
Question Subtype:	 	ODBC	
Title:	Writing SPSS data back to a database. 

Q. 
I've read data into SPSS 10 from a database. I've made various 
changes to the file, and I'd like to write my results back into 
my database as a new table. Can I do that with SPSS 10? 

A. 
Using the SAVE TRANSLATE command in syntax, you can write back 
to any database where you have a working ODBC connection. Please 
follow these instructions: 

1. Before using SAVE TRANSLATE, you must have an ODBC data source 
defined, and it must be able to read data into SPSS. 

2. Using the Database Wizard, read in a table from the database 
you want to write data back into. At step 6, choose to paste the 
syntax. You will need a portion of this syntax to create the 
SAVE TRANSLATE command. Here is an example of the type of syntax 
the wizard will build: 
GET DATA /TYPE=ODBC /CONNECT= 
 'DSN=Oracle8;UID=SCOTT;PWD=,T$M-y,v.c' 
 /SQL = 
 'SELECT "T4"."EMPNO" AS "EMPNO", "T4"."ENAME" AS "ENAME", "T4"."JOB" AS ' 
 '"JOB", "T4"."MGR" AS "MGR", "T4"."HIREDATE" AS "HIREDATE", "T4"."SAL" ' 
 'AS "SAL", "T4"."COMM" AS "COMM", "T4"."DEPTNO" AS "DEPTNO" FROM ' 
 '"SCOTT"."EMP" "T4"' 
. 

3. Copy the entire /CONNECT string. This string is used in the 
SAVE TRANSLATE syntax. For example, this is how the edited 
SAVE TRANSLATE command looks after adding the connect string from above: 
SAVE TRANSLATE TYPE=ODBC 
 /connect='DSN=Oracle8;UID=SCOTT;PWD=tiger' 
 /table="EMP3" 
 /unselect=retain 
 /replace 
 /map. 
Every connect string will be different, depending on the driver. 
The connect string needs to match exactly the connect string in the 
GET DATA command, including all of the line breaks. If the password 
is encoded, the plain text password should be substituted. 

4. For the table subcommand, use the name you want the table to have 
in the database, and make sure it is surrounded by quotes. The table 
name should not currently exist in the database. The rest of the syntax 
does not need to be edited. 

5. Run the syntax. You should receive a listing of which variables 
and their type that was written to the database.