Announcement

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

  • Issues running ranksum - says "no observations found"

    I'm relatively new to Stata so I am hoping that this error is a quick fix.

    I've been trying to run a Mann Whitney U test on data about whether administering a certain drug to patients affects their length of stay in the hospital. I have one column labeled GROUP (which has either "Drug" or "No Drug" as an entry) and another column labeled LOS (length of stay in the hospital, measured in hours).

    So far I've tried:
    ranksum LOS, by (GROUP) exact
    ranksum LOS, by (GROUP)
    ranksum GROUP, by (LOS) exact
    ranksum GROUP, by (LOS)

    No matter which iteration I try, I keep getting the same "no observations found" message.

    If anyone has dealt with something similar or knows a workaround, I would appreciate it so much!

  • #2
    while the "by()" variable can be string variable, the variable of interest cannot; it appears that both LOS and GROUP are string variables in your data (can't be sure since you did not provide a data example); if that is the case, you need to -destring- LOS using
    Code:
    destring LOS, replace

    Comment


    • #3
      Originally posted by Rich Goldstein View Post
      while the "by()" variable can be string variable, the variable of interest cannot; it appears that both LOS and GROUP are string variables in your data (can't be sure since you did not provide a data example); if that is the case, you need to -destring- LOS using
      Code:
      destring LOS, replace
      Thank you so much, that worked!

      Comment

      Working...
      X