OK, I would like to keep all the records of the individuals belgoning to the same IDno
whereby the admidate is less than the opdate
Therefore:
IDno 1 : Records episode1, 2
IDno 2: Records episode 1-3
IDno 3: Records episode 1-2
IDno 4: Records episode 1, Episode 2-4 (for procuedre 115 )
1. I tried
collapse (max) MI dvt, by (IDno procedureid)
But then this wouldn't give me IDno4 episode 2-4
Appreciate if someone can help and suggest perhaps a better syntax
I also tried filtering if opdate >admindate (however the issue is that it would include the missing values).
I tried substituting with 0 but this would automatically generate a 1960 date.
whereby the admidate is less than the opdate
Therefore:
IDno 1 : Records episode1, 2
IDno 2: Records episode 1-3
IDno 3: Records episode 1-2
IDno 4: Records episode 1, Episode 2-4 (for procuedre 115 )
1. I tried
collapse (max) MI dvt, by (IDno procedureid)
But then this wouldn't give me IDno4 episode 2-4
Appreciate if someone can help and suggest perhaps a better syntax
I also tried filtering if opdate >admindate (however the issue is that it would include the missing values).
I tried substituting with 0 but this would automatically generate a 1960 date.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(procedureid surgicalindex IDno episodeno admidate dvt MI opdate4) . 0 1 1 0 1 0 . 110 1 1 2 31 1 0 32 . 0 2 1 60 0 1 . . 1 2 2 305 1 1 . 112 0 2 3 335 0 1 336 . 0 3 1 366 0 1 . 113 1 3 2 397 0 1 397 . 1 3 3 425 0 1 . . 0 3 4 456 0 1 . . 0 3 5 486 0 1 . 114 1 4 1 517 1 0 518 . 0 4 2 548 1 0 . . 0 4 3 580 1 1 . 115 1 4 4 612 1 1 613 . 0 4 5 643 1 1 . end format %td admidate format %td opdate4

Comment