Announcement

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

  • Generating Variable That Depicts Increase

    My dataset comes from a survey with 5 waves that has a general score (variable GScore). I am trying to do the following:

    1) I am trying to generate a new variables that shows the General Score increase from each wave to the next (so that a decrease in scores will be a negative value). What code would work best for this? I am currently trying to use the following unsuccessfully:

    bysort id: gen GScore_increase = GScore - GScore[_n-1]

    2) What code would calculate the overall mean increase (or potential decrease) in the GScore across all waves for all participants?

    3) Is there an efficient code I could use to determine how many participants decreased or maintained the same GScore across all waves (i.e. how many never increased their Gscore across all the waves)?

  • #2
    A first shot at your first question would be something like
    Code:
    bysort id (wave): generate double GScore_increase = GScore - GScore[_n-1] if _n > 1
    but it assumes a lot about your dataset.

    For your other two, it will be better to follow the forum's FAQ.

    Comment


    • #3
      Originally posted by Joseph Coveney View Post
      A first shot at your first question would be something like
      Code:
      bysort id (wave): generate double GScore_increase = GScore - GScore[_n-1] if _n > 1
      but it assumes a lot about your dataset.

      For your other two, it will be better to follow the forum's FAQ.
      Unfortunately this did not work...does anyone else have any other ideas as to how to address this?

      Comment


      • #4
        It's hard to troubleshoot and come up with precise strategies in the absence of a data extract. As the Statalist FAQ advise (see esp. no. 12), please use the dataex command to post an extract.

        Comment


        • #5
          in addition, the FAQ also explains why "this did not work" is not helpful - more generally, please read the FAQ to get better answers

          Comment

          Working...
          X