*! version 1.0 october 2019

Title

getmxdata -- Import data from National Institute of Statistics and Geography (INEGI) & the Bank of Mexico (Banxico) into Stata

Syntax

getmxdata id_1 [id_2 ... id_n] , key(token)

Options

bie use INEGI's API for Bank of economic information (BIE) database

banxico use Banxico's API for Economic Information System (SIE) database

key(token) token for use webservice. Alphanumeric code
used to identify a user and give access to the service, one for each source.

Description

getmxdata allows to directly import historic economic series of Mexico. By using APIs of the National Institute of Statistics and Geography (INEGI)
and the Bank of Mexico (Banxico), Stata users can access to all variables in INEGI's Bank of economic information (BIE) database (over 300,000 series) and
from Economic Information System (SIE) database of Banxico. With the data, getmxdata also retrieve some basic metadata; description of series and units that
are stored as label of variables.

Remarks

1.- When using the webservice of INEGI, the ID designed is all numeric and due to Stata doesn't allow numeric varnames, variables are renamed using "v_" as
prefix to avoid an error. If you consult nominal GDP (ID is 494072) on Stata will apear as "v_494072", once the process has ended the user can rename the variable.

2.- Before using getmxdata, you must get a token from INEGI and Banxico.

- To get your token for INEGI webservice enter here: INEGI's API service.

- To get your token for Bancico webservice enter here: Banxico's API service.

3.- It's advisable that users be familiar whit definitions of indicators and catalogues before using getmxdata. Metadata retrived only
shows basic information, if you need more detailed description on a particular variable it's recommended to check directly on INEGI or Banxico.

- To consult series catalogue of INEGI enter here: INEGI's API service.

- To consult series catalogue of Banxico enter here: Banxico's API service.

4.- getmxdata uses moss command written by Robert Picard & Nick Cox, first make sure to install before use.

5.- Users can only use a webservice at once.

6.- getmxdata is designed to imporat all variables you want only if they have the same frecuency. This way, users have to make different consults
if you want to import variables that have diferent frequencies

Examples

local banxico_token token // paste in token your real token of Banxico

local inegi_token token // paste in token your real token of INEGI

getmxdata 494072 495466, bie key(`inegi_token') // Import nominal GDP and GDP deflator

getmxdata SE28533 SE28528, banxico key(`banxico_token') // Import remittances as number of operations and amount

Author

Miguel Angel Gonzalez Favila

For any inquiries please contac: miguel.gfavila@gmail.com