+ Reply to Thread
Results 1 to 2 of 2

Thread: Coding Help

  1. #1
    Points: 121, Level: 2
    Level completed: 43%, Points required for next Level: 29

    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Coding Help



    Lesson learned, always save syntax!!!

    I have a variable that has negative values. I want to code them as missing.

    I went to transform new variable.

    lowest through highest 0 and then coded it as 1.
    Then I assigned all other cases as sysmis.

    I'm pretty sure I need to do a select if case... but I can't remember how to do this correctly.

    Logically it should be something like:

    if variable < or equal to 0 variable= missing.
    if variable > or greater to 0 variable =1.

    Thanks for any help!

  2. #2
    Points: 946, Level: 16
    Level completed: 46%, Points required for next Level: 54

    Location
    Vienna, Austria, Europe
    Posts
    50
    Thanks
    1
    Thanked 8 Times in 7 Posts

    Re: Coding Help


    Is this what you want? The following Syntax should be equal to what you are describing here:
    Quote Originally Posted by kmmille3 View Post
    if variable < or equal to 0 variable= missing.
    if variable > or greater to 0 variable =1.
    Code: 
    DO IF your_variable<=0.
       COMPUTE new_variable=$sysmis.
    ELSE.
       COMPUTE new_variable=1.
    END IF.
    edit: there is a very useful 2000 pages pdf syntax reference file available from ibm. it's great if you already know the name of a command and just need some details on it or how it works. link: IBM_SPSS_Statistics_Command_Syntax_Reference.pdf
    Last edited by lorb; 06-18-2012 at 03:07 PM.
    Please be gracious in judging my english. (I am not a native speaker/writer.)

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats