« Return to Thread: creating new variables
sort cases by id repdate reptype.
if (id=lag(id) and repdate=lag(repdate) and reptype=209) morejobs=1.
if ((id ne lag(id) or repdate ne lag(repdate)) and reptype=209) morejobs=0.
if (id=lag(id) and repdate=lag(repdate) and reptype=209) moremoney=lag(money).
Hi
my data looks as below
|
id |
Repair Date |
Repair Type |
money |
|
16 |
20090430 |
115 |
23 |
|
30 |
20090325 |
209 |
45 |
|
30 |
20090124 |
103 |
62 |
|
47 |
20090409 |
209 |
78 |
|
47 |
20090409 |
101 |
69 |
I want to create two more variables for those who did repair type 209…the purpose is to know did they did more jobs on the same day of their visit and what the money generated from that ….at the final my data should be look as below
|
id |
Repair Date |
Repair Type |
money |
more jobs plus |
more money plus |
|
16 |
20090430 |
115 |
23 |
|
|
|
30 |
20090325 |
209 |
45 |
0 |
|
|
30 |
20090124 |
103 |
62 |
|
|
|
47 |
20090409 |
209 |
78 |
1 |
69 |
|
47 |
20090409 |
101 |
69 |
|
|
I can explain more if it is required
Thanks in advance
Abdulrahman
« Return to Thread: creating new variables
| Free embeddable forum powered by Nabble | Forum Help |