I am working on trade data set from BACI ( about 3 million observations )which reports countrys in UN CODE( Numbers e.g 004). I am interested to convert/replace the UN CODE to ISO3 Alpha ( Alphabet).For example , convert "124"to "CAN"
Sample data set
Start---------------------------------------------------------------------
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
Year Hs UNCODE UNCODE values qty
"2003" "10511" "004" "788" "37498" "0,583"
"2003" "10620" "004" "392" "74361" "0,226"
"2003" "731822" "124" "862" "16032" "2293"
"2003" "731823" "124" "392" "2339" "0,376"
"2003" "852439" "156" "860" "2641" "0,023"
-----------------------------------------------------------------------end
The code i wrote is given below:
Code:
gen siso=.- replace siso= CAN if UNCODE=="124"
.
replace siso= CAN if UNCODE=="124"
type mismatch
r(109);
type mismatch
r(109);
Regards
0 Response to Please Help Convert Country Code
Post a Comment