Add extension to all variable names
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 | 'BEGIN DESCRIPTION 'Add an extension to all variable names. 'END DESCRIPTION ' Posted by Jon Peck to SPSSX-L list on 2003/11/03 Option Explicit Sub Main Const SUFFIX= "_suffix" ' get variables Dim objDataDoc As ISpssDataDoc Dim objDocuments As ISpssDocuments Set objDocuments = objSpssApp.Documents Dim varList As Variant, newlist As Variant, oldlist As Variant Dim i As Long ' get the dictionary Set objDataDoc = objDocuments.GetDataDoc(0) ' Get the variables varList = objDataDoc.GetVariables (False) ' Iterate through the array of variables For i = LBound(varList) To UBound(varList) oldlist = oldlist & " " & varList(i) newlist = newlist & " " & varList(i) & SUFFIX Next i objSpssApp.ExecuteCommands "RENAME VARIABLES (" & oldlist & "=" & newlist & ").", _ False 'run cmd asynchronously End Sub |
Related pages
...