Announcement

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

  • Plotting transitions (Sankey diagram) with weights

    Hi everyone,

    I'm looking to track family-type transitions over 2021 and 2022 and then create a Sankey diagram either in Stata or Excel. I'm first not sure how to identify the transitions though. I have the variable family_type, which has different rows for the different years. I so far see two approaches:

    1) Reshape the data to get separate variables for the separate years
    2) Generate a new variable to have the data in the same row for one year, e.g.:
    sort hhid year
    by hhid: gen family_type_2021 = family_type[_n-1] if syear==2022

    I'm not sure which year I should use the weights from though. In the second option I'd have all the data in the rows for 2022, although I suppose I could also gen family_type_2022 = family_type[_n+1] if syear==2021. And I'm not sure about the first option either.

    If anyone has ever plotted (weighted) longitudinal transitions and can offer advice, I would be so grateful!
Working...
X