Hello! I am working with country-panel data, and wanted to know if I can replace the variables names (country names) of my original data set with something that is more uniform (i.e. ISO3 country-naming format). My data is formatted as below:
I have daily data stretching from roughly 1990 to 2021. I also have about 60 countries. I am aware of kountry, but this only works if the countries are observations, and not variables. With daily data, the data set is naturally long, and for this reason, reshape and xpose don't seem to be able to help solve my problem.
So far, I have created a separate .dta which just contains the countries as observations. Using kountry there gives me the desired country codes (ARG for Argentina, FRA for France, etc). But now, how can I import those country codes as my new variable names? Or am I going about this all wrong? Thanks in advance!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(day argentina saudiarabia unitedkingdom austria france) 19512 29.860113 . 1.8448875 . 29.91344 19513 30.020096 1.644 1.848199 6.3942 30.02937 19514 30.179895 1.6503 1.8629556 6.4046 29.98533 19515 30.23022 . 1.875309 6.4124 29.99614 19516 30.35522 1.6421 1.880363 . 29.983854 19517 . . 1.8915282 . 30.059195 19518 . . 1.8915282 . 30.059195 19519 30.459717 1.6385 1.8915282 . 30.059195 19520 30.410173 1.64 1.8727467 6.4417 29.91063 19521 30.51963 1.6341 1.8819928 6.4096 29.801025 19522 30.65406 1.6361 1.888474 6.4244 29.826956 19523 30.589745 1.6274 1.8838612 6.4232 29.728506 end format %tdNN/DD/CCYY day
So far, I have created a separate .dta which just contains the countries as observations. Using kountry there gives me the desired country codes (ARG for Argentina, FRA for France, etc). But now, how can I import those country codes as my new variable names? Or am I going about this all wrong? Thanks in advance!
Comment