Dear Stata users,
I downloaded the monthly exchange rate from the ECB site. The only availble option was : download xml. When I clicked on it the site https://www.ecb.europa.eu/stats/poli...s/html/usd.xml has been opened. It is the first time I had to do with XML format. I copied the lines to txt. I have something like that:
I cut some lines and renamed the file as EXCH.xml
Then I tried the command:
However, I saw an error: unrecognizable XML doctype
I downloaded the monthly exchange rate from the ECB site. The only availble option was : download xml. When I clicked on it the site https://www.ecb.europa.eu/stats/poli...s/html/usd.xml has been opened. It is the first time I had to do with XML format. I copied the lines to txt. I have something like that:
Code:
This XML file does not appear to have any style information associated with it. The document tree is shown below. <CompactData xmlns="http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message https://stats.ecb.europa.eu/stats/vocabulary/sdmx/2.0/SDMXMessage.xsd"> <Header> <ID>EXR-HIST_2023-01-18</ID> <Test>false</Test> <Name xml:lang="en">Euro foreign exchange reference rates</Name> <Prepared>2023-01-18T15:55:20</Prepared> <Sender id="4F0"> <Name xml:lang="en">European Central Bank</Name> <Contact> <Department xml:lang="en">DG Statistics</Department> <URI>mailto:[email protected]</URI> </Contact> </Sender> <DataSetAgency>ECB</DataSetAgency> <DataSetID>ECB_EXR_WEB</DataSetID> <Extracted>2023-01-18T15:55:20</Extracted> </Header> <DataSet xmlns="http://www.ecb.europa.eu/vocabulary/stats/exr/1" xsi:schemaLocation="http://www.ecb.europa.eu/vocabulary/stats/exr/1 https://stats.ecb.europa.eu/stats/vocabulary/exr/1/2006-09-04/sdmx-compact.xsd"> <Group CURRENCY="USD" CURRENCY_DENOM="EUR" EXR_TYPE="SP00" EXR_SUFFIX="A" DECIMALS="4" UNIT="USD" UNIT_MULT="0" TITLE_COMPL="ECB reference exchange rate, US dollar/Euro, 2:15 pm (C.E.T.)"/> <Series FREQ="D" CURRENCY="USD" CURRENCY_DENOM="EUR" EXR_TYPE="SP00" EXR_SUFFIX="A" TIME_FORMAT="P1D" COLLECTION="A"> <Obs TIME_PERIOD="1999-01-04" OBS_VALUE="1.1789" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-05" OBS_VALUE="1.1790" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-06" OBS_VALUE="1.1743" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-07" OBS_VALUE="1.1632" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-08" OBS_VALUE="1.1659" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-11" OBS_VALUE="1.1569" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-12" OBS_VALUE="1.1520" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-13" OBS_VALUE="1.1744" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-14" OBS_VALUE="1.1653" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-15" OBS_VALUE="1.1626" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-18" OBS_VALUE="1.1612" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-19" OBS_VALUE="1.1616" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-20" OBS_VALUE="1.1575" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-21" OBS_VALUE="1.1572" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-22" OBS_VALUE="1.1567" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-25" OBS_VALUE="1.1584" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-26" OBS_VALUE="1.1582" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-27" OBS_VALUE="1.1529" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-28" OBS_VALUE="1.1410" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-01-29" OBS_VALUE="1.1384" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-02-01" OBS_VALUE="1.1338" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-02-02" OBS_VALUE="1.1337" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-02-03" OBS_VALUE="1.1337" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-02-04" OBS_VALUE="1.1263" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-02-05" OBS_VALUE="1.1292" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-02-08" OBS_VALUE="1.1246" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-02-09" OBS_VALUE="1.1333" OBS_STATUS="A" OBS_CONF="F"/> <Obs TIME_PERIOD="1999-02-10" OBS_VALUE="1.1342" OBS_STATUS="A" OBS_CONF="F"/> </Series> </DataSet> </CompactData>
Then I tried the command:
Code:
xmluse "U:\EXCH.xml"