+ Reply to Thread
Results 1 to 7 of 7

Thread: Trying to define missing values with syntax (for string AND numeric variables)

  1. #1
    Points: 45, Level: 1
    Level completed: 90%, Points required for next Level: 5

    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Trying to define missing values with syntax (for string AND numeric variables)



    Hi all, I am very new to SPSS, so I hope someone can help me with what seems to be a basic problem.
    I have a data set of several thousand variables and am trying to define the missing values for them. Obviously doing this in the GUI would take forever and a day. So usually that would be done with the MISSING VALUES ALL command. Only that this fails because I have string AND numeric variables.
    Can anybody tell me how to set the missing values for my data set ... like looping through all my variables, check what type it is and then set a missing value accordingly.

    I would be very grateful for help.
    Martin

  2. #2
    Points: 45, Level: 1
    Level completed: 90%, Points required for next Level: 5

    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Trying to define missing values with syntax (for string AND numeric variables)

    I apologize for bumping this. Unfortunately time is of the essence and I am positively lost on this.
    I thought my problem was something simple ... as in easy to solve for experienced users. Is it too simple to be honored with an answer? Or is it more difficult than I thought?

    Thanks.
    Martin

  3. #3
    Points: 1,827, Level: 25
    Level completed: 27%, Points required for next Level: 73

    Location
    Gloucester
    Posts
    35
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Re: Trying to define missing values with syntax (for string AND numeric variables)

    Despite not being an expert, since you seem to be desperate, I shall have a go anyway.

    If you fail to define any system missing values, the system will define them for you automatically and you might be satisfied with those.

    You could look up the command MISSING in the syntax manual and also the "Missing values" subsection of "Universals" in that same manual, which is supplied on the DVDs and should have been installed on your PC in a documentation/English/manuals directory or you could do a search for the "IBM SPSS Statistics xx Command Syntax Reference.pdf" where xx is your current version number.

    One possibility is to using the MISSING command specifying sets of vara to varb for the string and numeric fields separately, which might be easy if most of the string fields are say at the front and the most of the numerics are at the end of your layout.

    Hope this helps

  4. #4
    Points: 45, Level: 1
    Level completed: 90%, Points required for next Level: 5

    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Trying to define missing values with syntax (for string AND numeric variables)

    Hey Robert,

    thanks for the reply. I will have another look into it. But as I mentioned above I already found the MISSING VALUES command. And it was no use. Variable sets might be an idea, only the string variables are scattered throughout my data set, so I couldn´t just create a set by variable number.
    Also I am not sure how to create a set, anyway. I leafed through web and manual and the only thing I came up with, was an article saying that creating sets with the syntax is not possible. And MISSING VALUES command does only accept the identifier ALL or a list of variables.

    Thanks anyway .. I´ll keep on digging ...
    Martin

  5. #5
    Points: 45, Level: 1
    Level completed: 90%, Points required for next Level: 5

    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Trying to define missing values with syntax (for string AND numeric variables)

    Soooo, I finally found a way to solve my problem. For anyone having the same trouble, here it goes.

    There is a downloadable extension named SPSSINC_SELECT_VARIALES which generates a macro that does the trick.

    You can find and download it here:
    https://www.ibm.com/developerworks/m...c-9d66dcda49d7

    And here´s a link describing how to use it:
    https://www.ibm.com/developerworks/m...ommand?lang=en

    You also will have to have Python installed.

    Edit: Just for completeness, here is my own little syntax example to change the MiISSING VALUES of all String variables to '-1'

    Code: 
    SPSSINC SELECT VARIABLES MACRONAME = "!test"
    / PROPERTIES TYPE=STRING
    
    MISSING VALUES !test ('-1').
    Case closed .

    Cheers
    Martin
    Last edited by Ocensoul; 07-19-2012 at 02:57 AM.

  6. #6
    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: Trying to define missing values with syntax (for string AND numeric variables)

    Just be aware that declaring any string as missing (besides the empty string) can potentially break SPSS. So if you have strange errors in the near future when you do any analysis with those variables that's the reason.
    Please be gracious in judging my english. (I am not a native speaker/writer.)

  7. #7
    Points: 45, Level: 1
    Level completed: 90%, Points required for next Level: 5

    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Trying to define missing values with syntax (for string AND numeric variables)


    Uh, thanks. Didn´t know that. But I have some variables where not having a value is actually okay. And I´d like to make a difference between those cases.

    But I will keep it in mind.
    Martin

+ 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