Hi,
I am having a little trouble with the collapse command.
I am using panel data for countries between 2019-2023 and wish to convert this to cross sectional by generating the mean of all variables by country.
I used the following command:
collapse (mean) oneyrs-id2, by(country)
This worked successfully in removing the observations over time and replacing the observations with the mean over time for all of my countries bar Luxembourg in which there are two observations for this country.
The table is a refined version of the codebook which I'm left with.
I was wondering if anyone could help explain why Luxembourg appears twice?
I've looked over the original data and was unable to see anything unusual compared to the other observations.
Many thanks in advance
I am having a little trouble with the collapse command.
I am using panel data for countries between 2019-2023 and wish to convert this to cross sectional by generating the mean of all variables by country.
I used the following command:
collapse (mean) oneyrs-id2, by(country)
This worked successfully in removing the observations over time and replacing the observations with the mean over time for all of my countries bar Luxembourg in which there are two observations for this country.
country | oneyrs | twoyrs | threeyrs |
aus | 246201.2 | 278573.8 | 304683.6 |
bel | 428949.6 | 457741 | 478359.6 |
cro | 32479.667 | 42146.333 | 46478.667 |
den | 182680 | 191480.6 | 195460.8 |
ger | 2828315.4 | 2980678.2 | 3167158.6 |
ita | 1713787.8 | 1835984.2 | 1887771.6 |
lux | 45127.75 | 46993 | 46686.75 |
lux | 49898 | 49124 | 44444 |
pol | 460628.2 | 466367.6 | 474317 |
spa | 1005823.6 | 1043116.8 | 1076492.6 |
I was wondering if anyone could help explain why Luxembourg appears twice?
I've looked over the original data and was unable to see anything unusual compared to the other observations.
Many thanks in advance
Comment