Hi All,
I have a filename.dta with several numerical variables such as M040810
I'd like to split M040810. The left end digit of M040910 indicates if the subject has (1) or not (2) some disease and the other two digits indicate year of diagnosis or not applicable (88). So I'd like to create two new variables: the first a binary variable newvariable= 1 if the condition is present and newvariable=2 otherwise and a second one with the year of diagnosis if applicable.
The problem is that I don't know how to do it
Can you help me?
Thank you in advance
I have a filename.dta with several numerical variables such as M040810
Code:
+--------------------+
| Cod_Mi~1 M040810 |
|--------------------|
1. | 2 288 |
2. | 3 288 |
3. | 4 288 |
4. | 5 288 |
5. | 7 180 |
|--------------------|
6. | 10 288 |
7. | 12 288 |
8. | 13 288 |
9. | 14 288 |
10. | 15 178 |
|--------------------|
11. | 17 288 |
12. | 18 288 |
13. | 19 288 |
14. | 21 288 |
15. | 22 288 |
The problem is that I don't know how to do it

Can you help me?
Thank you in advance

Comment