*SPSS syntax example by www.spss-tutorials.com.
*1. Create 40 Test Cases.
data list free/id.
begin data
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
end data.
compute id = $casenum.
*2. Create Dichotomous Input Variables.
set seed 1.
do repeat #v = v1 to v6.
compute #v = rv.bernoulli(.5).
end repeat.
execute.
formats all(f2).
*3. Solution 1: spell out multipliers.
compute comb1 = v1 * 100000 + v2 * 10000 + v3 * 1000 + v4 * 100 + v5 * 10 + v6 * 1.
execute.
*4. Optional: use nice notation with leading zeroes for result.
formats comb1(n6).
*5. Solution 2: use power function for multipliers in loop (faster but harder).
compute comb2 = 0.
do repeat #v = v1 to v6 / #e = 1 to 6.
compute comb2 = comb2 + #v * 10** (6 - #e).
end repeat.
execute.
formats comb2(n6).
*6. Done.