Announcement

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

  • Need help with surveyset

    I have a study using HCUP National Inpatient Sample. My commands were all working until I got to hospital characteristics. This is what I get:

    . svy, subpop(NINTcat_2): tab HOSP_REGION NAS if YEAR ==2016, column pearson
    no observations in subpop() subpopulation
    subpop() = 1 indicates observation in subpopulation
    subpop() = 0 indicates observation not in subpopulation
    r(461);

    Thank you.

  • #2
    Stata is telling you that your data set has no observations where NINTcat_2 == 1 and YEAR == 2016, or, if it does, all such observations have missing values for HOSP_REGION or NAS, or whatever variable you used as a pweight in your -svyset- command is zero. You can easily verify this directly with:
    Code:
    count if NINTcat_2 == 1 & YEAR == 2016 & !missing(HOSP_REGION, NAS) & pweight_variable != 0
    and you will get zero. (Substitute the actual name of your pweight variable in the above.)

    From there, two possibilities exist. It may be that there is something wrong with your data set: there ought to be such observations but they aren't there. In that case, you will need to review the data management leading up to that, identify the errors that led to the loss of those observations, and fix that (and any other errors you stumble over along the way--where one error is found, others may lurk still unseen). Or it may be that the data set is correct and your expectation that such observations would exist was mistaken. In that case, just omit that particular command (and any others that would depend on those observations) and move on.

    Added: Actually, it could be a bit more complicated than what I said. Another way such observations could exist but not recognized in that command is if variables mentioned in your -svyset- command to specify strata or sampling units are missing. Having not seen your -svyset- command, I can't be more detailed than that. So, more correctly, your command relies on finding observations for which NINTcat_2 == 1 and YEAR == 2016, and HOSP_REGION and NAS are both non-missing, the pweight variable (if there is one) is > 0, and any stratum or sampling unit variables are all non-missing. Write a command to count the variables that satisfy that complete condition and you will get zero.
    Last edited by Clyde Schechter; 15 Dec 2022, 22:28.

    Comment


    • #3
      Thank you for your reply. I found out that the 2016 HCUP NIS data set I uploaded did not have the HOSP_REGION variable. I had to download it again, and that is how I fixed the problem. I am such a neophyte. Thank you.

      Comment

      Working...
      X