Прежде чем начать, хочу отметить, что я отметил этот вопрос как VBA, потому что я не могу на самом деле создать новый тег для Winwrap, и мне сказали, что Winwrap почти такая же, как VBA.WWBasic + SPSS, скрипт для переименования меток значений
Я работаю над SPSS V19.0, и я пытаюсь создать код, который поможет мне идентифицировать и присваивать метки значений всем значениям, которые не имеют метки в указанной переменной (или всех переменных) ,
Псевдокод ниже для версии, где это единственная переменная (возможно, введенная текстовым полем или, возможно, отправленная через пользовательский диалог в программе SPSS Stats (вызовите файл .sbs из синтаксиса, указав ему имя переменной).
Вот псевдокод:
Sub Main(variable As String)
On Error GoTo bye
'Variable Declaration:
Dim i As Integer, intCount As Integer
Dim strValName As String, strVar As String, strCom As String
Dim varLabels As Variant 'This should be an array of all the value labels in the selected record
Dim objSpssApp As 'No idea what to put here, but I want to select the spss main window.
'Original Idea was to use two loops
'The first loop would fill an array with the value lables and use the index as the value and
'The second loop would check to see which values already had labels and then
'Would ask the user for a value label to apply to each value that didn't.
'loop 1
'For i = 0 To -1
'current = GetObject(variable.valuelist(i)) 'would use this to get the value
'Set varLabels(i) = current
'Next
'Loop for each number in the Value list.
strValName = InputBox("Please specify the variable.")
'Loop for each number in the Value list.
For i = 0 To varLabels-1
If IsEmpty (varLabels(i)) Then
'Find value and ask for the current value label
strVar = InputBox("Please insert Label for value "; varLabels(i);" :","Insert Value Label")
'Apply the response to the required number
strCom = "ADD VALUE LABELS " & strVar & Chr$(39) & intCount & Chr$(39) & Chr$(39) & strValName & Chr$(39) &" ."
'Then the piece of code to execute the Syntax
objSpssApp.ExecuteCommands(strCom, False)
End If
'intCount = intCount + 1 'increase the count so that it shows the correct number
'it's out of the loop so that even filled value labels are counted
'Perhaps this method would be better?
Next
Bye:
End Sub
Это не в коде способ функционирования, это только в основном псевдо-код для процесса, который я хочу достичь, я просто ищу некоторую помощь в этом , если возможно, это было бы волшебным.
Большое спасибо заранее
Мав
thanks MPelletier –