Announcement

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

  • Generate variable with differences between observations

    I have a panel data set on Mexican regions and agegroups, respectively divided by high and low income groups. For every case I calculated a numeracy Index (abcc). I want to calculate abcc differences between the income groups for each state and agegroup. Can anybody help me with the command? I tried < by agegr (state), sort: gen abccc = abcc if med_high_skill == 1 - abcc if med_high_skill == 0 >, but it does not work with this one.

  • #2
    Hallo:
    welcome to this forum.
    Please note:
    1) as per FAQ example/excerpt (via -dataex-) are really welcome on this forum. Thanks;
    2) I'm not clear with what your main by "calculate";
    3) as per FAQ again, "does not work" is totally unhelpful to interested listers.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hello, "calculate" here meant i collapsed the data and obtained an index for numeracy, called abcc. this abcc value was collapsed among states, agegroups and a dummy for income group.
      Now I want to generate a new variable containing the differences in this index for each state and agegroup between the two income groups.

      Comment


      • #4
        Hallo:
        point 1), #2 still applies.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X