SPSS Statistics

 View Only
  • 1.  SPSS version 28 shows text in the data view

    Posted Tue August 31, 2021 09:53 AM
    Hello,
    I am just wondering if anyone has used IBM SPSS version 28 - on the variable view i defined my variable for example, 1=Red, 2=orange and 3=yellow. On the data view if i enter 1, text for red will appear, so also for orange when I enter 2 and yellow when i enter 3. However, if there is no value defined for a number it stays. Example, If i entered 4 and there is no defined value in the variable view, it stays as 4. Does anyone know what could be the cause? Thanks for you help!

    ------------------------------
    Ngozi Ilouno
    ------------------------------

    #SPSSStatistics


  • 2.  RE: SPSS version 28 shows text in the data view

    Posted Tue August 31, 2021 10:10 AM
    Hi. Unless I am misunderstanding, you have VALUE LABELS defined for values 1, 2, and 3, but not for other possible values of a variable. When there are no labels defined, the value will show in the data cell.

    ------------------------------
    Rick Marcantonio
    Quality Assurance
    IBM
    ------------------------------



  • 3.  RE: SPSS version 28 shows text in the data view

    Posted Tue August 31, 2021 10:19 AM
    Thanks Rick, yes you are right! Please any thought(s)?

    Kind regards

    ------------------------------
    Ngozi Ilouno
    ------------------------------



  • 4.  RE: SPSS version 28 shows text in the data view

    Posted Tue August 31, 2021 10:59 AM
    Edited by System Fri January 20, 2023 04:37 PM
    Well, nothing elegant. You can run this in syntax for example:

    VALUE LABELS my_variable 1 'Red' 2 'Orange' 3 'Yellow' 4 'Other' 5 'Other' .

    Notice that you can repeat the same label - Other, in this case. Use whatever string you want except a blank; that will return the value again - and then all 4s and 5s (or more if you add the appropriate label) appear as 'Other'.

    Assuming the values without labels are equivalent, you could use RECODE after all the data are entered:

    RECODE my_variable (4 thru HI=4).
    EXECUTE.

    That way, you have just one label for Other.

    ------------------------------
    Rick Marcantonio
    Quality Assurance
    IBM
    ------------------------------



  • 5.  RE: SPSS version 28 shows text in the data view

    IBM Champion
    Posted Tue August 31, 2021 11:40 AM
    Users sometimes mistake the value labels mechanism for a validation mechanism.  There is no requirement that all values be labelled.

    However, there is a data validation procedure (Data > Validation) that can check variable values.  The procedure includes a set of predefined rules, and you can add your own.

    There is also a function available through Python programmability, spssaux2.FindUnlabelledValues that finds variable values that do not have a value label.




    --





  • 6.  RE: SPSS version 28 shows text in the data view

    Posted Wed September 08, 2021 11:06 AM
    Just a question about spssaux2.FindUnlabelledValues. It includes a comment saying that an OMS operation is needed for each variable in order to get the value labels, which will slow the procedure down. The code shows no reference to OMS, however. Maybe OMS is associated with spss.DataStep() or spssdata.Spssdata ?

    I use a program that uses spss.EvaluateXPath to retrieve value labels and values that occur in the dataset without having value labels. A one time OMS operation and no further calls, apart from calling spss.EvaluateXPath for each variable. I'm going to compare the speeds of this program and spssaux2.FindUnlabelledValues. Obviously, my program needs the cTABLES module, wich makes is less generally applicable.

    ------------------------------
    Kees Smit
    ------------------------------



  • 7.  RE: SPSS version 28 shows text in the data view

    IBM Champion
    Posted Wed September 08, 2021 12:09 PM
    This function has two ways to get the value labels for the test.  If it can use the spss.Dataset class, this will be efficient, and no OMS operations are required.  However, that class cannot always be used.  An instance of the Dataset class can only be created within a data step or StartProcedure-
    EndProcedure block.

    If that can't be done - no data step or procedure state has been created by the caller code, then it uses the valuelabelsTyped method of the spssaux.VariableDict class, which uses OMS to create a variable dictionary object in the xml workspace for just the selected variable which is then used to get the value labels.  OMS is used to capture the relevant table from the DISPLAY DICTIONARY command, which is run under the covers.

    I haven't ever systematically benchmarked these methods.  There are a lot of different scenarios to consider varying the number of variables and the number of value labels they have.  It would be more straightforward to use the spss.CreateXPathDictionary function, but that only works on the entire data set, so if there are thousands of variables and you want the information for only a few, this might be relatively slow, especially if there are irrelevant variables with large numbers of value labels, so the spssaux.VariableDict class does not use it.  I have seen cases where a variable has thousands of value labels for, e.g., postal codes or SIC codes, so this is a real possibility.

    This code predates the creation of the Dataset class, but I did not update it to use the spss.Dataset class, because that could break existing user code.

    With all that said, I haven't ever heard of a case where the existing methods are impracticably slow, so I haven't been motivated to work on performance in this area.

    --





  • 8.  RE: SPSS version 28 shows text in the data view

    Posted Thu September 09, 2021 03:37 AM
    Ah, thank you, Jon. This explains a lot. I found the OMS part hidden in spssaux.getValueLabels().

    Thanks also for mentioning spss.CreateXPathDictionary, that function may come in very handy some day.

    It's good to know that performance is not expected to be an issue here. I originally got the value labels from repeatedly catching FRE commands in XML, and that really took a long time.

    ------------------------------
    Kees Smit
    ------------------------------