My data are like below. It consists of one variable price, and another variable group. The group variable indicates which group a certain observation belongs to.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear price group 4099 11 4749 11 3799 12 4816 16 7827 20 5788 21 4453 10 5189 16 10372 17 4082 13 11385 20 14500 16 15906 13 3299 9 5705 20 4504 17 5104 16 3667 7 3955 13 3984 8 4010 17 5886 17 6342 21 4389 9 4187 10 11497 22 13594 18 13466 15 3829 9 5379 16 6165 23 4516 15 6303 16 3291 17 8814 20 5172 16 4733 16 4890 20 4181 14 4195 10 10371 17 4647 11 4425 11 4482 17 6486 8 4060 16 5798 20 4934 7 5222 16 4723 17 4424 13 4172 7 9690 15 6295 11 9735 12 6229 6 4589 8 5079 8 8129 8 4296 16 5799 10 4499 5 3995 11 12990 14 3895 10 3798 11 5899 14 3748 9 5719 11 7140 12 5397 15 4697 15 6850 16 11995 14 end
The data shown above simply comes from "sysuse auto,clear". I just rename the variable trunk as group to make it easier for you to understand my problem.
Thank you!
0 Response to Calculate difference across rows by the value of a third variable
Post a Comment