Markus Eberhardt describes how to pull Comtrade data straight into Stata:
11/03/2011 UN COMTRADE data in Stata: Mitch Abdon of the Stata Daily blog recently suggested a way of combining the UN ComtradeTools and Stata. Comtrade is the International Merchandise Trade Statistics (IMTS) of the UN, which records item-level trade for all countries in the world and contains around 1.8 bn observations from 1962 onwards. Access to this data is free, but for technical reasons a maximum of 50,000 observations per query (even more reason to use the Stata Daily application). Having installed the software which allows one to download Comtrade data (registration/subscription required for access) there are a number of simple steps to pull this data directly into Stata and save it. In fact, the entire process is run from within Stata once everything is installed. Since I had some minor trouble setting up and getting this tool to work I’ve written a simple Stata 10 do-file with additional information.