Announcement

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

  • How to control the sequence and identify the change

    I would like to control the sequence of my variable, in the example data it is Bid.

    I want to control by rounds, if the Bid increases/decreases/not change.

    How can I evaluate it by observation wise? Suppose that P is from 1301 to 1310 i.e, 10 subjects.



    Code:
    input int P byte(Rd Bid)
    1301   1  21
    1301   2  63
    1301   3 100
    1301   4  39
    1301   5  58
    1301   6  39
    1301   7  42
    1301   8  52
    1301   9  47
    1301  10  85
    1301  11  75
    1301  12  69
    1301  13  71
    1301  14  73
    1301  15  75
    1301  16  81
    1301  17  63
    1301  18  86
    1301  19  88
    1301  20  91
    1301  21  92

  • #2
    I'm really not sure I understand what you want. But this:
    Code:
    by P (Rd), sort: gen delta = sign(Bid - Bid[_n-1])
    creates a new variable that will be 1 if Bid is increased from its previous value, 0 if it is unchanged, and 1 if it is decreased from its previous value. (And it will always be missing in the first observation because there is no previous observation to compoare to.)

    If this is not what you want, please post back with another example, and include hand-calculated results showing what you want, along with a narrative explaining how you did the hand calculation.

    Comment

    Working...
    X