title: SPSS Macro to Automate Sequential Variable References
body: <p>I've had a tough time getting a simple loop to work in SPSS that isn't based on variables.</p>
  
  <p>In a nutshell, I want to write</p>
  
  <pre><code>!sequentialVars varStr=/Var/ i=/20/.
  </code></pre>
  
  <p>or similar and get:
  Var1 Var2 Var3 Var4 Var5 ... Var19 Var20
  to put into a cTable or anywhere else that takes a string of variable names.</p>
  
  <p>In pseudo VB it would be:</p>
  
  <pre><code>varString = "AnyVarName"
  for i=1 to 20
    newVarList = concatenate(newVarList," ",varString, i)
  next i
  </code></pre>
  
  <p>I can't even echo back the i in an SPSS loop, let alone concatenate it.</p>
  
  <p>Thank you!</p>