I have a database where each case holds info about handwritten digits, eg:

Digit1Seq : when in the sequence of 12 digits the "1" was drawn

Digit1Ht: the height of the digit "1"

Digit1Width: its width

Digit2Seq: same info for digit "2"

on up to digit "12"

I find I now need the information organized a little differently as well. In particular I want a new variables with the height and width of the *first* digit written, then the height and width of the *second*, etc., as SPSS vars

FirstDigitHt

FirstDigitWidth ...

TwelvthDigitWidth

Here's a Python program I wrote to do within SPSS what ought to be a very simple computation, but it runs into a sort of namespace problem:

```
BEGIN PROGRAM PYTHON.

import spss
indices = ["1", "2", "3","4","5", "6", "7", "8", "9", "10", "11", "12"]
seq=0
for i in indices:
  spss.Submit("COMPUTE seq = COMDigit" + i + "Seq.")
  spss.Submit("EXECUTE.")
  spss.Submit("COMPUTE COM" + indices[seq] + "thWidth =  COMDigit" + i + "Width.")
  spss.Submit("COMPUTE COM" + indices[seq] + "thHgt =  COMDigit" + i + "Hgt.")
  spss.Submit("EXECUTE.")

END PROGRAM.

```

It's clear what's wrong here: the value of `seq` in the first `COMPUTE` command doesn't get back to Python, so that the right thing can happen in the next two `COMPUTE`commands. Python's value of `seq` doesn't change, so I end up with SPSS code that gives me only two variables (`COM1thWidth` and `COM1Hgt`), into which `COMDigit1Width`, `COMDigit2Width`, etc. get written.

Is there any way to get Python to access SPSS's value of `seq` each time so that the string concatenation will create the correct `COMPUTE`? Or am I just thinking about this incorrectly?

Have googled extensively, but find no way to do this.

As I'm new to using Python in SPSS (and not all that much of wiz with SPSS) there may well be a far easier way to do this.

All suggestions most welcome.