Announcement

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

  • type mismatch r(109);

    Hello
    I'm trying to drop the observations that have no national ID number (nino) and I'm using "drop if nino == ." command.
    Unfortunately is not working saying " type mismatch r(109); "
    Can someone help me?
    Thanks

  • #2
    Lucian:
    welcome to this forum.
    Is -nino- in -string- format?
    If that were the case, you should modify your code as follows:
    Code:
    drop if nino==""
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi, I don't know what is string format but is worked :o

      Comment


      • #4
        Lucian:
        Code:
        . use "C:\Program Files (x86)\Stata15\ado\base\a\auto.dta"
        (1978 Automobile Data)
        
        . list make price in 1
        
             +---------------------+
             | make          price |
             |---------------------|
          1. | AMC Concord   4,099 |
             +---------------------+
        
        .
        -make- is -string-; -price- is numeric.

        See -help format-.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Let me amplify the helpful replies by Carlo Lazzaro :

          Format is an overloaded word in computing.

          It can mean file format; data format (often better called structure or layout); variable or storage type; and display format. And very likely it has other meanings too that I have forgotten or never knew.

          In Stata (all else can suit itself) there are string display formats associated with string variables which hold text or character strings.

          A type mismatch is this: you are asking for something to be done that applies to a numeric variable or entity, but what you have is a string; or vice versa. It's like trying to fit a square toy into a round hole, or a round toy into a square hole.

          Comment

          Working...
          X