Adding a new external database
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator
Adding a new external database
Hello, How does one add a new external database please? I would have this one in mind for example: https://data.snb.ch/en Thanks a lot, Günter
Re: Adding a new external database
I found this website: https://sdmx.herokuapp.com/ but didn't get it to work.
-
- EViews Developer
- Posts: 790
- Joined: Tue Sep 16, 2008 3:00 pm
- Location: Irvine, CA
Re: Adding a new external database
We currently don't have a db connector that will allow you to directly browse for and download SNB data. However, there is another solution.
I took a quick look at their website, and they provide some instructions on how to download their data directly in CSV format. See this page that discusses their API. I believe their instructions are to build a URL that contains the name of the table identifier, like their example:
Once you have a URL for the data you're interested in, you can run the following EViews command to start our import wizard to download and import their data into a workfile:
Once you go thru the wizard, you can tell it to ignore a certain number of header lines, use the first row as a name row, use semi-colon as the delimter, and then set the proper data types for each column. Finally, you can tell EViews to remember this link so that whenever you wish, you can ask EViews to update the linked data in the future.
After the import wizard finished, here's what the detailed IMPORT command looked like for me:
If you run this last command directly within the EViews command window (or in an EViews program), you'll end up with a workfile that contains 3 columns from the source URL that you can refresh whenever you want.
Steve
I took a quick look at their website, and they provide some instructions on how to download their data directly in CSV format. See this page that discusses their API. I believe their instructions are to build a URL that contains the name of the table identifier, like their example:
Code: Select all
https://data.snb.ch/api/cube/snbbipo/data/csv/en
Once you have a URL for the data you're interested in, you can run the following EViews command to start our import wizard to download and import their data into a workfile:
Code: Select all
import https://data.snb.ch/api/cube/snbbipo/data/csv/en
Once you go thru the wizard, you can tell it to ignore a certain number of header lines, use the first row as a name row, use semi-colon as the delimter, and then set the proper data types for each column. Finally, you can tell EViews to remember this link so that whenever you wish, you can ask EViews to update the linked data in the future.
After the import wizard finished, here's what the detailed IMPORT command looked like for me:
Code: Select all
import(link) https://data.snb.ch/api/cube/snbbipo/data/csv/en ftype=ascii rectype=crlf skip=3 fieldtype=delimited custom=";" colhead=1 eoltype=pad badfield=NA @id date d0 @smpl @all
If you run this last command directly within the EViews command window (or in an EViews program), you'll end up with a workfile that contains 3 columns from the source URL that you can refresh whenever you want.
Steve
Re: Adding a new external database
Hi Steve,
Thanks a lot for your reply.
I looked at the link, but the data doesn't appear as a time series, it seems. Ideally, I am after a file like the attached one from this link:
https://data.snb.ch/en/topics/snb#!/cube/snbbipo
Also, I would like to add other databases from other national databases. Do you have a team which deals with this?
Thanks a lot.
Best,
Günter
Thanks a lot for your reply.
I looked at the link, but the data doesn't appear as a time series, it seems. Ideally, I am after a file like the attached one from this link:
https://data.snb.ch/en/topics/snb#!/cube/snbbipo
Also, I would like to add other databases from other national databases. Do you have a team which deals with this?
Thanks a lot.
Best,
Günter
- Attachments
-
- snb-data-snbbipo-en-all-20210129_0900.xlsx
- (73.36 KiB) Downloaded 205 times
-
- EViews Developer
- Posts: 790
- Joined: Tue Sep 16, 2008 3:00 pm
- Location: Irvine, CA
Re: Adding a new external database
The page you are referring to is showing exactly the same dataset as in my import example.
This data doesn't appear as a time series in the EViews workfile because it defaulted to being read in as an undated panel. And the reason for this is because the CSV data provided by SNB is in a "stacked" format. That means each row in their CSV file is keyed by both date and variable name. Hence there are multiple rows for the same date, but for different variables.
My initial example was only meant to show that it is possible for EViews to "link" to an external datasource via URL. And if SNB had provided the data in a normal "unstacked" format (e.g. date, var1, var2, var3, etc. on each row), then EViews would've recognized the pattern and then imported them where each variable column was its own separate series object.
But because of the "stacked" format, you'll have to do an additional step to get it into the unstacked format you're looking for. Here are my suggestions:
First, import the same CSV file into a dated panel workfile (this import command is slightly different than before):
Once imported, do a page unstack to a new page:
Now you should see your data elements as you expect on the new workfile page.
Because the unstacked page is not "linked" to the first page, you'll have to recreate/re-run the pageunstack command every time you refresh the first linked page so that you can get all the new data.
As for making requests to our database team, feel free to make requests for various external databases in our forum here. We will take a look to see if it would make sense to add them to our next version of EViews.
Steve
This data doesn't appear as a time series in the EViews workfile because it defaulted to being read in as an undated panel. And the reason for this is because the CSV data provided by SNB is in a "stacked" format. That means each row in their CSV file is keyed by both date and variable name. Hence there are multiple rows for the same date, but for different variables.
My initial example was only meant to show that it is possible for EViews to "link" to an external datasource via URL. And if SNB had provided the data in a normal "unstacked" format (e.g. date, var1, var2, var3, etc. on each row), then EViews would've recognized the pattern and then imported them where each variable column was its own separate series object.
But because of the "stacked" format, you'll have to do an additional step to get it into the unstacked format you're looking for. Here are my suggestions:
First, import the same CSV file into a dated panel workfile (this import command is slightly different than before):
Code: Select all
import(link) https://data.snb.ch/api/cube/snbbipo/data/csv/en ftype=ascii rectype=crlf skip=3 fieldtype=delimited custom=";" colhead=1 eoltype=pad badfield=NA @freq M @id d0 @date(date) @smpl @all
Once imported, do a page unstack to a new page:
Code: Select all
pageunstack(namepat=*_?) d0 dateid @ *
Now you should see your data elements as you expect on the new workfile page.
Because the unstacked page is not "linked" to the first page, you'll have to recreate/re-run the pageunstack command every time you refresh the first linked page so that you can get all the new data.
As for making requests to our database team, feel free to make requests for various external databases in our forum here. We will take a look to see if it would make sense to add them to our next version of EViews.
Steve
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13309
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Adding a new external database
GFXFTS wrote:
Also, I would like to add other databases from other national databases. Do you have a team which deals with this?
For a direction connection to a database, such as the ones you see built into the File->Open->Database menu, we have an open source language that allows data distributors to have EViews connect to their data.
Details start here:
http://eviews.com/EViews12/Enterprise/EDX.html
Anyone can write an extension to connect to a database, so you might have some luck contacting SNB and asking them if they have plans to implement a connection, or if they'd be willing to help you, or anyone else, write one.
Follow us on Twitter @IHSEViews
Re: Adding a new external database
Hello, That is very helpful. Thanks a lot. Best wishes, Günter
Who is online
Users browsing this forum: No registered users and 21 guests