Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8180339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:11:33+00:00 2026-06-07T00:11:33+00:00

before I start I want to point out that I tagged this question as

  • 0

before I start I want to point out that I tagged this question as VBA because I can’t actually make a new tag for Winwrap and I’ve been told that Winwrap is pretty much the same as VBA.

I’m working on SPSS V19.0 and I’m trying to make a code that will help me identify and assign value labels to all values that don’t have a label in the specified variable (or all variables).
The pseudo code below is for the version where it’s a single variable (perhaps inputted by a text box or maybe sent via a custom dialogue in the SPSS Stats program (call the .sbs file from the syntax giving it the variable name).

Here is the Pseudo Code:

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

This is in no way functioning code, it’s just basically pseudo code for the process that I want to achieve I’m just looking for some help on it, if you could that would be magic.

Many thanks in advance
Mav

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:11:35+00:00Added an answer on June 7, 2026 at 12:11 am

    Winwrap and VBA are almost identical with differences that you can find in this post:
    http://www.winwrap.com/web/basic/reference/?p=doc_tn0143_technote.htm
    I haven’t used winwrap, but I’ll try to answer with my knowledge from VBA.

    • Dim varLabels As Variant

    You can make an array out of this by saying for example
    dim varLabels() as variant ‘Dynamically declared array
    dim varLabels(10) as variant ‘Statically declared array
    dim varLabels(1 to 10) as variant ‘Array starting from 1 – which I mostly use
    dim varLabels(1 to 10, 1 to 3) ‘Multidimensional array

    • Dim objSpssApp As ?

    “In theory”, you can leave this as a variant type or even do

    Dim objSpssApp 
    

    Without further declaration, which is basically the same – and it will work because a variant can be anything and will not generate an error. It is good custom though to declare you objects according to an explicit datatype in because the variant type is expensive in terms of memory. You should actually find out about the objects class name, but I cannot give you this. I guess that you should do something like:

    set objSpssApp = new <Spss Window> 
    set objSpssApp = nothing 'In the end to release the object 
    
    • Code:

      ‘loop 1
      For i = 0 To -1
      current = GetObject(variable.valuelist(i)) ‘would use this to get the value
      Set varLabels(i) = current
      Next

    I don’t exactly know why you want to count from 0 to -1 but perhaps it is irrelevant.
    To fill an array, you can just do: varLabels(i) = i
    The SET statement is used to set objects and you don’t need to create an object to create an array. Also note that you did not declare half of the variables used here.

    • Code:

      strVar = InputBox(“Please insert Label for value “; varLabels(i);” :”,”Insert Value Label”)

    Note that the concatenation operator syntax is &.
    This appears to be the same in WinWrap:
    http://www.winwrap.com/web/basic/language/?p=doc_operators_oper.htm
    But you know this, since you use it in your code.

    • Code:

      ‘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?

    I’m not sure if I understand this question, but in theory all loops are valid in any situation, it depends on your preference. For … Next, Do … Loop, While … Wend, in the end they all do basically the same thing. intCount = intCount + 1 seems valid when using it in a loop.

    • Using Next (for … next)

    When using a counter, always use Next iCounter because it increments the counter.

    I hope this reply may be of some use to you!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before I start, I want to point out that I'm pretty sure this actually
First off, before I ask, i would like to point out that this question
Before I start, I want to make it clear that my code is working
So, to start off, I want to point out that I know that these
I want to get one record before start date and end date DtpFrom means
Am using Mediainfo library in my C# project,before start invoking this dll,i just ran
(Before I start, yes I have asked a similar question before; unfortunately due to
There is two parts to this question. The first is, I want to do
Before start let me tell my experience: I am experienced with C#.NET, web services,
I usually try to do TDD with not much analysis (no diagrams) before start

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.