Announcement

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

  • dropping values in scientific notation

    Hi there, I have a variable that has some very small values (4.28e-10, 4.65e-88, for example).

    I would like to keep if a variable has a value of less than 5.0x10^-8.

    I am struggling to work in scientific notation.

    I have tried the code: drop ldlp if ldlp>=5e-08 but it returns "invalid syntax"
    I wonder if this has something to do scientific notation?

    Thanks for any help


  • #2
    The invalid syntax is a consequence of the formation of the drop command, not the scientific notation. The drop command followed by a variable name tells Stata to drop the variable. The drop command followed by a condition drops observations (across all variables). Assuming you want to drop observations, use

    Code:
    drop if ldlp>=5e-08
    Stata/MP 14.1 (64-bit x86-64)
    Revision 19 May 2016
    Win 8.1

    Comment


    • #3
      Adding to Carole's comment, it is not clear what you mean to happen to the observations where ldlp>=5e-08
      • Do you want to replace the value of ldlp in those observations with a missing value, so they will be excluded from analysis?
      In this case
      Code:
      replace ldlp = . if ldlp>=5e-08
      • Do you want to drop the observations from the data set, so that none of the variables will be available for any analysis, even if it doesn't involve ldlp?
      In this case, as Carole suggested,
      Code:
      drop if ldlp>=5e-08
      The problem with dropping the observations is that someone will come back to you and ask how the observations with a large value of ldlp compared to those with a small value, for some other measure in the data. And you will have dropped all the observations you need for comparison.

      Comment

      Working...
      X