Announcement

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

  • How to separate variables by gender

    Hi, I collected pre-post dyadic data for an relationship education intervention. My data is in currently in wide format. The items are in the format of Question_Item_Time (example Q10_1_1 and Q10_1_2 such that _1 is pre intervention _2 is post intervention. I need to specify these variables by gender, I am hoping for something like this: Q10_1_1_f/Q10_1_2_f and Q10_1_1_m/Q10_1_2_m such that _f is female and _m is male. I have a gender variable so I know who is male and female, but the variables themselves are not separated by gender yet.

    I need the variables in this format so I can create scales separated by gender and use this code: alpha Q10_1_1_f Q10_2_1_f Q10_3_1_f Q10_3_1_f, gen(preSM_female)

    I know this is confusing and I barely know how to describe it myself, let alone run the code for it. Is it possible to do this? Thank you so much for your help!

  • #2
    Jenna:
    no example/excerpt of your dataset makes everything more difficult.
    With a generous dose of guess-work, you may want to try something like:
    Code:
    bysort gender: gen wanted=Q_sayalfa/Q_saybeta
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment

    Working...
    X