I'm working with a large longitudinal dataset, and trying to create a unique ID variable, by concatenating two other existing, broader ID variables. One is a double type, and the other is long. The result is a string, and the destring function doesn't seem to be working. An example of what I'm working with is below. I'm then trying to use the resulting NEW_ID to create a new PERSON_ID that starts from 1. I'm using the following code to generate PERSON_ID: egen double PERSON_ID=group(NEW_ID). But the results don't seem to distinguish between unique NEW_ID values. I'm wondering if the fact that NEW_ID is a string variable is the issue. The table below shows what I'm aiming to generate. Thanks for any insights...
| ID_1 | ID_2 | NEW_ID | PERSON_ID |
| 1234 | 2030405060 | 12342030405060 | 1 |
| 1234 | 2030405060 | 12342030405060 | 1 |
| 1234 | 2030405060 | 12342030405060 | 1 |
| 1234 | 2030405060 | 12342030405060 | 1 |
| 2345 | 2030405060 | 23452030405060 | 2 |
| 2345 | 2030405060 | 23452030405060 | 2 |
| 2345 | 2030405060 | 23452030405060 | 2 |
| 2345 | 2030405060 | 23452030405060 | 2 |
| 6789 | 2030405060 | 67892030405060 | 3 |
| 6789 | 2030405060 | 67892030405060 | 3 |
| 6789 | 2030405060 | 67892030405060 | 3 |
| 6789 | 2030405060 | 67892030405060 | 3 |

Comment