Announcement

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

  • Having trouble while using inequality signs.

    Hi.

    I am having trouble with following script. It is a real basic function but I don't know why it does not work.
    As you can see below, I am trying to seperate normal and hypertensive group. And I just cannot find out
    why htn and htn1 has different number of persons in it.

    Please share some wisdom for me. BTW htn group presents actual number.
    Many Thanks.

    gen htn=1 if sys>140 | dia>90
    replace htn=0 if missing(htn)

    gen htn1=0 if sys<=140 | dia<=90
    replace htn1=1 if missing(htn1)

    Click image for larger version

Name:	Cap 2019-10-11 15-24-37-143.png
Views:	1
Size:	7.9 KB
ID:	1519967

    Last edited by OEM Park; 11 Oct 2019, 02:27.

  • #2
    Whatever your given name is, welcome to this forum.
    It is not clear to me why don't you include in the same variable hypertensive and normotensive blood pressure values and then use -label- to seprate them.
    It is also methodologically wrong (and potentially disastrous) to code missing values as zero.
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Your code might need to be

      Code:
      gen htn=sys>140 | dia>90 if !missing(sys, dia)
      
      
      gen htn1= sys<=140 | dia<=90 if !missing(sys, dia)
      
      tab1 htn htn1, missing
      as missing counts as both > 140 and > 90. Also | and & are different! There is a 2 x 2 table implied by your thresholds (setting missing values aside).

      Comment


      • #4
        Thank you for both comments. Now it works very well!

        I am a MD but with just a small knowledge when it comes to statistics. But my job requires me to analyze field data like this one.
        Therefore I have been relying on this forum ever since using the program and learn by myself.

        And Carlo, I am sorry for being anonymous.

        Comment


        • #5
          OEM Park: remaining anonymous is your own right that comes at the cost of seeing your queries left unreplied, though.
          Please note that there are good (and basically mateship/friendship-related) reasons to privide other listers with our own given and family names (if interested, there was a thread on this topic some years ago: https://www.statalist.org/forums/for...for-real-names).
          Kind regards,
          Carlo
          (Stata 18.0 SE)

          Comment

          Working...
          X