прежде чем я начну, я хочу указать, что я пометил этот вопрос как VBA, потому что я не могу создать новый тег для Winwrap, и мне сказали, что Winwrap почти такой же, как VBA.
Я работаю над 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
Это никоим образом не работающий код, это просто псевдокод для процесса, которого я хочу достичь. Я просто ищу помощи в этом, если бы вы могли, это было бы волшебно.
Заранее большое спасибо
Мав