Announcement

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

  • Help with classifying variables! urgent

    hello, i have a variable called nausea divided into three other variables: 1st variable nausea (have you ever experienced nausea?1=yes and 2=no), nausea1 (if yes, during week 1-4 of pregnancy? 1=yes, 2= no), nausea2 (if yes, during week 5-12 of pregnancy? 1=yes,2 =no). i want to study nausea during trimester1 so combining nausea1 and nausea2, to get the variable from week 1-12. please i would like some help thank you!!!

  • #2
    Hi Nina,

    If the variable 'week' is in your dataset, you can try the following codes:
    gen nausea_trim1 = nausea1 if week >= 1 & week <= 4
    replace nausea_trim1 = nausea2 if week > 4 & week <= 12

    Comment


    • #3
      Flagging your post as "urgent" implies that you think that other posts are not urgent. This is at worst unintentionally offensive and at best futile. The only difference that claiming urgency will make is that you will be asked, as now, not to do that, please. Indeed, the FAQ Advice, which you were asked to read before posting anything, does explain that claims of urgency are of no interest to anybody else.

      For your problem,

      Code:
       
      gen nausea3 = min(nausea1, nausea2)
      will be 1 if either of the input variables is 1 and 2 otherwise. For the other way round, use max().

      For almost all Stata applications, life will be much easier with indicator variables coded 1 and 0.

      Comment

      Working...
      X