Dear,
I would like to set my data as panel data, but the panel variable (ID) has a string format.
Here you see the beginning of the dataset. The panel variable goes as follows: "Country abbreviation" + "-" + "numerical values" + "-" + "numerical values"
Person |
identifier |
(fix across |
modules and |
waves) | Freq. Percent Cum.
-------------+-----------------------------------
AT-030522-01 | 2 0.10 0.10
AT-054255-02 | 2 0.10 0.19
AT-060684-01 | 2 0.10 0.29
AT-070982-01 | 2 0.10 0.38
AT-070982-02 | 2 0.10 0.48
.
.
.
ES-019673-02 | 2 0.10 35.44
ES-027984-02 | 2 0.10 35.54
ES-035082-01 | 2 0.10 35.63
ES-045069-01 | 2 0.10 35.73
ES-093754-01 | 2 0.10 35.82
ES-108677-01 | 2 0.10 35.92
.
.
.
What I would like to do is
1. To replace the country identifier with country codes:
For the above example, AT (Austria) with 11, ES (Spain) with number 15.

2. To delete the two "-"s.
I've tried solving my problem with the function subinstr() but I was unsuccesful, as I've just started with STATA recently..
Is there anyone who could help me how to tackle this?
I would like to set my data as panel data, but the panel variable (ID) has a string format.
Here you see the beginning of the dataset. The panel variable goes as follows: "Country abbreviation" + "-" + "numerical values" + "-" + "numerical values"
Person |
identifier |
(fix across |
modules and |
waves) | Freq. Percent Cum.
-------------+-----------------------------------
AT-030522-01 | 2 0.10 0.10
AT-054255-02 | 2 0.10 0.19
AT-060684-01 | 2 0.10 0.29
AT-070982-01 | 2 0.10 0.38
AT-070982-02 | 2 0.10 0.48
.
.
.
ES-019673-02 | 2 0.10 35.44
ES-027984-02 | 2 0.10 35.54
ES-035082-01 | 2 0.10 35.63
ES-045069-01 | 2 0.10 35.73
ES-093754-01 | 2 0.10 35.82
ES-108677-01 | 2 0.10 35.92
.
.
.
What I would like to do is
1. To replace the country identifier with country codes:
For the above example, AT (Austria) with 11, ES (Spain) with number 15.
2. To delete the two "-"s.
I've tried solving my problem with the function subinstr() but I was unsuccesful, as I've just started with STATA recently..
Is there anyone who could help me how to tackle this?
Comment