SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 

 View Only
  • 1.  SELECT IF command in SYNTAX.

    Posted Mon January 18, 2021 05:44 PM

    I am writing a piece of code in the Syntax of SPSS-statistics-25.0. The code is the following.

    GET DATA /TYPE=XLSX

    /FILE='file'

    /SHEET=name 'Sheet2'

    /CELLRANGE=full

    /READNAMES=on

    /ASSUMEDSTRWIDTH=32767.

    EXECUTE.

    DATASET NAME DataSet1 WINDOW=FRONT.

    RANK VARIABLES= WA CI (D) /RANK /PRINT=YES /TIES=MEAN.

    SELECT IF( RWA EQ 1 AND RCI EQ 1).

    The problem is at the last line of the above code. SPSS selects the right data and then, SPSS creates two variables called RWA and RCI. So far, things are fine. Then, SPSS should select cases only when the two variables assume value 1 and 1 simultaneously. Unfortunately, the latter does not happen.

    Am I wrong somewhere in the code?






    #SPSSStatistics
    #Support
    #SupportMigration


  • 2.  RE: SELECT IF command in SYNTAX.
    Best Answer

    Posted Mon January 18, 2021 07:10 PM

    What does actually happen? Note that the RANK procedure results are not necessary integers in the case of ties.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 3.  RE: SELECT IF command in SYNTAX.
    Best Answer

    Posted Mon January 18, 2021 08:14 PM

    Hi Jon, Spss gest data form the external source, an Excel file. I can see the two variables WA and CI. SPSS creates two RANK variables, by default these two variables are named RWA and RCI. The values of variables RWA are like 3.000, 2.000. It's very unlucky to have ties in my case. Actually there are no ties. However all the above things work fine. Nothing to say! The problem arises when SELECT IF starts being operative. Cases are not selected. It is alike SELECT IF has been completely ignored by SPSS. I honestly do not why. Maybe are variables RWA and RCI not recognized by the SYNTAX of SPSS-STATISTICS, even if variables appear in the DATA EDITOR of SPSS-STATISTICS.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 4.  RE: SELECT IF command in SYNTAX.
    Best Answer

    Posted Mon January 18, 2021 08:15 PM

    Hi Jon, Spss gest data from the external source, an Excel file. I can see the two variables WA and CI. SPSS creates two RANK variables, by default these two variables are named RWA and RCI. The values of variables RWA are like 3.000, 2.000. It's very unlucky to have ties in my case. Actually there are no ties. However all the above things work fine. Nothing to say! The problem arises when SELECT IF starts being operative. Cases are not selected. It is alike SELECT IF has been completely ignored by SPSS. I honestly do not why. Maybe are variables RWA and RCI not recognized by the SYNTAX of SPSS-STATISTICS, even if variables appear in the DATA EDITOR of SPSS-STATISTICS.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 5.  RE: SELECT IF command in SYNTAX.
    Best Answer

    Posted Mon January 18, 2021 08:43 PM

    If the variables were not recognized, you would get an error message.


    Are you sure that selection is not happening? The actual selection would not be visible until the dat are passed by running a procedure or an EXECUTE command.


    If you still see that, can you send me a sample dataset that shows this (jkpeckSupport Member)?






    #SPSSStatistics
    #Support
    #SupportMigration


  • 6.  RE: SELECT IF command in SYNTAX.
    Best Answer

    Posted Mon January 18, 2021 11:14 PM

    I am really stupid. I have missed the EXECUTE COMMAND. It selects the unique case where (1,1) happens. It completely works. Really thanks Jon.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 7.  RE: SELECT IF command in SYNTAX.
    Best Answer

    Posted Mon January 18, 2021 11:17 PM

    No worries. Many people are confused by lazy execution even thought it is more efficient. That's why the default in the gui is to paste lots of EXECUTE commands. But EXECUTE is just a procedure that does nothing but pass the data, so you can run just about anything after a transformation command such as SELECT without using EXECUTE.






    #SPSSStatistics
    #Support
    #SupportMigration