Announcement

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

  • How to collapse to match the data?

    I want to match the data in way that my lossin variable should be matched with succed so that I will be able to run sign-rank test. However I did not find a handy way.


    do you have any suggestion? I want to write the data below like that:
    Code:
    input int P float(lossin succed) int Tour byte PiT
    1301  23 26 1 3


    Code:
    input int P float(freq lossin succed) int Tour byte PiT
    1301 0  .  . 1 3
    1301 1 23  . 1 3
    1301 2  . 26 1 3
    1301 3  .  . 1 3
    1301 4  .  . 1 3
    1302 0  .  . 1 3
    1302 1 21  . 1 3
    1302 2  . 16 1 3
    1302 3  .  . 1 3
    1302 4  .  . 1 3
    1303 0  .  . 1 3
    1303 1 24  . 1 3
    1303 2  . 33 1 3
    1303 3  .  . 1 3
    1303 4  .  . 1 3
    1304 0  .  . 1 3
    1304 1 25  . 1 3
    1304 2  . 44 1 3
    1304 4  .  . 1 3
    1305 0  .  . 1 3
    1305 1 28  . 1 3

  • #2
    Perhaps this will start you in a helpful direction.
    Code:
    clear
    input int P float(freq lossin succed) int Tour byte PiT
    1301 0  .  . 1 3
    1301 1 23  . 1 3
    1301 2  . 26 1 3
    1301 3  .  . 1 3
    1301 4  .  . 1 3
    1302 0  .  . 1 3
    1302 1 21  . 1 3
    1302 2  . 16 1 3
    1302 3  .  . 1 3
    1302 4  .  . 1 3
    1303 0  .  . 1 3
    1303 1 24  . 1 3
    1303 2  . 33 1 3
    1303 3  .  . 1 3
    1303 4  .  . 1 3
    1304 0  .  . 1 3
    1304 1 25  . 1 3
    1304 2  . 44 1 3
    1304 4  .  . 1 3
    1305 0  .  . 1 3
    1305 1 28  . 1 3
    end
    collapse (firstnm) lossin succed Tour PiT, by(P)
    list, clean noobs
    Code:
    . list, clean noobs
    
           P   lossin   succed   Tour   PiT  
        1301       23       26      1     3  
        1302       21       16      1     3  
        1303       24       33      1     3  
        1304       25       44      1     3  
        1305       28        .      1     3

    Comment

    Working...
    X