Script help

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Script help

Tom1234
This post was updated on .
Hi Forum,
I've started making a script that will hopefully allow me to name all the values (via value labels)
in a specified variable via input boxes and a loop that checks to see if there is currently a value label for that value.
This is the code so far:

'#Language "WWB-COM"

Option Explicit

Sub Main
'#####################
'Begin Description
'Script to apply value labels via a text box input to each number present in a value list.
'End Description
'#####################

On Error GoTo Bye

'Variable Declaration:
Dim i As Integer, intCount As Integer
Dim varName As String, stringVar As String, stringCom As String
Dim labels As String 'This should really be an array of all the value labels in the selected record

varName = InputBox("Please specify the variable you wish to name the values of.")
'Loop for each number in the Value list.
 For i = 0 To labels
If IsEmpty (Lables(i)) Then 
 'Find value and ask for the current value label
 stringVar = InputBox("Please insert Label for value "; labels(i);" :","Insert Value Label")
 'Apply the response to the required number
 stringCom = "ADD VALUE LABELS " & varName & Chr$(39) & intCount & Chr$(39) & Chr$(39) & stringVar & Chr$(39) &" ."
 'Then the piece of code to execute the Syntax
objSpssApp.ExecuteCommands stringCom, False
 'Not sure on how to do this, hence help required
End If 
intCount = intCount + 1 'increase the count so that it remembers the number
 Next
Bye:
End Sub

I realise that there are significant parts of the code missing, but I'd very much like some help with it if you could spare some time.

Many thanks in Advance
Tom

"Lo there do I see my father. Lo there do I see my mother and my sisters and my brothers. Lo there do I see the line of my people, back to the beginning. Lo, they do call to me, they bid me take my place among them, in the Halls of Valhalla, where the brave may live...forever."
Reply | Threaded
Open this post in threaded view
|

Re: Script help

Tom1234
I added the code that I am working on *see above*

"Lo there do I see my father. Lo there do I see my mother and my sisters and my brothers. Lo there do I see the line of my people, back to the beginning. Lo, they do call to me, they bid me take my place among them, in the Halls of Valhalla, where the brave may live...forever."
Reply | Threaded
Open this post in threaded view
|

Re: Script help

Tom1234
This post was updated on .
This is the spss syntax to apply a value label, I just basically want to do this on a much larger scale with an inputbox for each value.
STRING labelvar (A120).
COMPUTE labelvar=VALUELABEL(var1).
DO REPEAT varlist=var2, var3, var4
/newvars=labelvar2, labelvar3, labelvar4.- STRING newvars(A120).
-COMPUTE newvars=VALUELABEL(varlist).
END REPEAT.

"Lo there do I see my father. Lo there do I see my mother and my sisters and my brothers. Lo there do I see the line of my people, back to the beginning. Lo, they do call to me, they bid me take my place among them, in the Halls of Valhalla, where the brave may live...forever."
Reply | Threaded
Open this post in threaded view
|

Automatic reply: Script help

Susan Maree Cotton
I am currently away from the office and will have limited access to email.  I will respond to your email when possible.