Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • If a value is a dot, is it a missing?

    Dear All,

    this is probably a question to the developers, but I wanted to double-check with the community before reporting.

    So: if something is equal to a dot in Stata, is it a missing?

    Or in other words, if X==. does this always result in missing(X)==1 or are there any exceptions? (according to help missing there are none).

    Thank you, Sergiy Radyakin

    Stata/MP 13.0, Windows

    Last edited by Sergiy Radyakin; 18 Sep 2016, 05:20. Reason: Added Stata version description

  • #2
    I can't think of a reason to doubt this. But as you are aware,. although missing(.) yields 1 the converse isn't necessarily true. missing() yields 1 for any argument that is missing, numeric or string.

    Code:
    . di missing(.)
    1
    
    . di missing(.a)
    1
    
    . di missing(.z)
    1
    
    . di missing("")
    1
    Why ask?

    Comment


    • #3
      [answer posted in wrong thread]

      Comment


      • #4
        Let me add two cases where values present as a dot but are not missing.
        Code:
        . di missing(".")
        0
        
        . set obs 1
        number of observations (_N) was 0, now 1
        
        . gen x = 42
        
        . label define x 42 "."
        
        . label values x x
        
        . list x in 1
        
             +---+
             | x |
             |---|
          1. | . |
             +---+
        
        . di missing(x[1])
        0

        Comment


        • #5
          Well, OK. But in the example in #4, x[1] isn't a dot. It's a 42 wearing a dot costume. I know that William Lisowski knows that. But there are lots of posts on this Forum relating to problems that stem from users who confuse the way a variable is displayed with what its actual internal content is. This can arise with value labels, as here, or with display formatting.

          So, had I written #4, I would have presented it more as "Not everything that looks like a dot is missing, but everything that is a dot is."

          Comment


          • #6
            Dear Nick, William and Clyde, thank you for responding.
            Your answers have reinforced my expectation that if a value is equal to a dot it must be also missing in the sense of the function missing(). Since I observe the opposite, I will be reporting this as a bug to Stata developers:

            Click image for larger version

Name:	missing.png
Views:	1
Size:	2.1 KB
ID:	1357128



            NAME1 is a double storage type variable. The name of the variable is irrelevant. I can add that the value in NAME1[1] is not a result of a typical transformations you do in Stata, so a Stata user is unlikely to encounter the same in a regular session. But that particular value then causes consequences throughout Stata:

            Code:
            . misstable summarize
                                                                           Obs<.
                                                            +------------------------------
                           |                                | Unique
                  Variable |     Obs=.     Obs>.     Obs<.  | values        Min         Max
              -------------+--------------------------------+------------------------------
                     NAME1 |         3                   0  |      3          .           .
                 benchmark |         1                   2  |      2          1           2
              -----------------------------------------------------------------------------
            In the meanwhile, I use the workaround x>=. to identify missing values instead of the function missing().

            Thank you,Sergiy Radyakin


            Comment


            • #7
              Sergly - Could you share with us the result of
              Code:
              di %21x NAME1[1]
              di %16H NAME1[1]

              Comment


              • #8
                Dear William, sure:

                Code:
                . di %21x NAME1[1]
                +1.0000000000000X+3ff
                
                . di %16H NAME1[1]
                7fe0000000000000
                
                . di NAME[1]==.
                1
                
                . di missing(NAME[1])
                0
                I have submitted the case with detailed description and a pointer to this thread to Stata's tech-support.

                Best, Sergiy

                Comment


                • #9
                  Thanks, Sergly. I will be interested in the response. The values displayed are identical those created by for example gen double x = . which of course produces a value that works as expected. These results lead me to suspect, and I think your example confirms, that using display with these formats does not guarantee an exact representation of the contents of a variable in memory. I'm guessing that's because NAME[1] is implicitly an expression and gets passed through Stata's expression evaluation before being passed to display.

                  Comment

                  Working...
                  X