Dear Stata Users,
I want to create a new variable as "Profit" based on the previous variable that includes both "Revenue" and "Cost".
It is too laborious to do it manually because the number of observations is more than 2 lakh.
For example:
Thank you very much
I want to create a new variable as "Profit" based on the previous variable that includes both "Revenue" and "Cost".
It is too laborious to do it manually because the number of observations is more than 2 lakh.
For example:
ID | Code (Revenue=1, Cost=2) | Amount (Rs) | Profit=Cost-Revenue |
12 | 1 | 1000 | 500 |
12 | 2 | 1500 | . |
13 | 1 | 500 | 500 |
13 | 2 | 1000 | . |
14 | 1 | 500 | -400 |
14 | 2 | 100 | . |
15 | 2 | 500 | . |
15 | 1 | 300 | 200 |
Thank you very much
Comment