Thread Subject: ECB Statistical Data Warehouse - How to fetch it???

Subject: ECB Statistical Data Warehouse - How to fetch it???

From: Wu

Date: 8 Nov, 2008 22:11:02

Message: 1 of 1

Hello ppl,

is there a way to fetch easily data from the ECB SDW ( http://sdw.ecb.europa.eu/) - The data is for free!!!


Currently, I am using simply urlwrite.m and textread.m to download .csv-Files. However, it's possible to use .xml as well.

It would be very convient to fetch data like from the FRED2 database (see fred.m, Database Toolbox; Federal Reserve St.Louis!) - Something nice, stable and fast????


Some Explanation: The function below download .csv text files. The first 3 lines includes about the dataset blabla stuff. THE BIG PROBLEM is that the SERIES_KEY published by ECB SDW isn't sufficient to download the dataset - There is an additional 3-digit number required (look at 'mKey'). These digits you can figure out after downloading a dataset manually - Not nice.

HAVE ANYONE AN IDEA HOW TO UTILIZE THE ECB SDW MORE EFFICIENTLY???


EXAMPLE: French CPI

[vD vX] = fECBcsv('ICP.M.FR.N.000000.4.INX');
plot(vD,vX); datetick('x')



CODES:

function [vD vX] = fECBcsv(cKey)
%
mKey = {'ICP','122';... %Consumer Price Index
              'STS','132';... %Industrial Producer Prices
             };

mFrq = {'M','yyyymmm';... %Monthly data
              'A','yyyy'}; %Annual data
    
% (1a) Generate URL
cTmp = strread(cKey,'%s','delimiter','.');
cAdjKey = [ char( mKey( strcmp( mKey(:,1) , cTmp{1} ) ,2) ), '.', cKey];

sUrlname = ['http://sdw.ecb.europa.eu/export.do?exportType=csv&SERIES_KEY=',cAdjKey]

% (1b) Date format for (4)
cFormat= char(mFrq( strcmp( mFrq(:,1) , cTmp{2} ) ,2));

% (1c) Delete temporary variables
clear cTmp mKey cKey cAdjKey mFrq

% (2) Download .csv-file
path(path,'c:\');
urlwrite(sUrlname,'c:\data.txt');
[cD,cX] = textread('data.txt','%s %s','headerlines',3,'delimiter',',');
delete('c:\data.txt');

% (4) Transform Cell-Arrays, flip so vX(1) is the oldest observation
vX = flipud(str2double(cX));
vD = flipud(datenum(cD,cFormat));
clear cX cD cFormat

end

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
database Wu 8 Nov, 2008 17:15:06
fetch Wu 8 Nov, 2008 17:15:06
data fetch Wu 8 Nov, 2008 17:15:06
database toolbox Wu 8 Nov, 2008 17:15:06
ecb Wu 8 Nov, 2008 17:15:06
sdw Wu 8 Nov, 2008 17:15:06
european centra... Wu 8 Nov, 2008 17:15:06
statistical dat... Wu 8 Nov, 2008 17:15:06
macro data Wu 8 Nov, 2008 17:15:06
retrieve data Wu 8 Nov, 2008 17:15:06
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com