Export group to Excel
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
Export group to Excel
I constructed a group object from panel data objects. When I export the group to Excel with the following statement, the observation ID (date+cross section) is missing. How do I change that?
wfsave(type=excelxml) {%tableloc}state_backtest.xlsx range="forecast!b1" @smpl {%graph_sample} @keep __g_backtest
wfsave(type=excelxml) {%tableloc}state_backtest.xlsx range="forecast!b1" @smpl {%graph_sample} @keep __g_backtest
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Export group to Excel
Put the id series into the group.
When you tell EViews to just keep a group it literally only keeps the series in that group.
When you tell EViews to just keep a group it literally only keeps the series in that group.
Follow us on Twitter @IHSEViews
Re: Export group to Excel
If the reason behind export failing to include observation ID is because the group does not retain it, then the following statement should do it:
wfsave(type=excelxml) {%tableloc}state_backtest.xlsx range="actual!a1" @keep {%varlist} @smpl {%graph_sample}
where %varlist is a list of panel data series. But this statement did not produce observation ID either in the Excel table either. The problem seems to lie with exporting panel data to Excel.
wfsave(type=excelxml) {%tableloc}state_backtest.xlsx range="actual!a1" @keep {%varlist} @smpl {%graph_sample}
where %varlist is a list of panel data series. But this statement did not produce observation ID either in the Excel table either. The problem seems to lie with exporting panel data to Excel.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Export group to Excel
Code: Select all
wfcreate a 1990 2000 10
alpha mycrosssections = "myid" + @str(@crossid)
alpha mydates = @datestr(@date, "YYYY")
series y=@nrnd
group g mydates mycrosssections y
wfsave(type=excelxml) myfile.xlsx @keep g
Works just fine.
Follow us on Twitter @IHSEViews
Re: Export group to Excel
Great. It seems to me that I need to add the date and the cross section explicitly to the group.
Given a panel data series, how do I extract its date and cross section?
Given a panel data series, how do I extract its date and cross section?
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Export group to Excel
Code: Select all
alpha mycrosssections = "myid" + @str(@crossid)
alpha mydates = @datestr(@date, "YYYY")
or @pageids
Follow us on Twitter @IHSEViews
Re: Export group to Excel
My panel data series is indexed by state abbreviation and date such as "AK - 50Q1". @crossid gives me index 1, ..., 50, rather than state abbreviation. How do I obtain the latter?
@PAGEIDS gives an error message: @PAGEIDS is not a Genr or series expression function.
@PAGEIDS gives an error message: @PAGEIDS is not a Genr or series expression function.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Export group to Excel
I'm a bit confused - do you know the name the of your cross-section identifier?
Follow us on Twitter @IHSEViews
Re: Export group to Excel
The name of my cross section id is _P. For instance if I want to select a sample from the state of Alaska, I issue the following statement:
smpl 2008 2010 if _P="AK"
Eviews documentation on series object does not contain a lot of information on panel data series. Can you point me to some good reference?
smpl 2008 2010 if _P="AK"
Eviews documentation on series object does not contain a lot of information on panel data series. Can you point me to some good reference?
Re: Export group to Excel
I also wish to know how to extract a particular data point from my panel data series X. For instance, I wish to assign the value of the series value at 2010Q2 for the cross section of "AK" to a scalar. How do I reference that data point?
Re: Export group to Excel
For a series without cross section, I can obtain the value at any date with @elem(X, "2010Q2"). When the series is a panel, I get the error message: "Date does not uniquely define observation in panels".
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Export group to Excel
Phil09 wrote:The name of my cross section id is _P. For instance if I want to select a sample from the state of Alaska, I issue the following statement:
smpl 2008 2010 if _P="AK"
So just include _p in the group?
Follow us on Twitter @IHSEViews
Re: Export group to Excel
Gareth, thank you. That worked!
My mistake is that I kept on thinking that cross section ID is attribute of a panel data series. It is actually an object of the panel data workfile, in which all series have the same cross section ID.
My mistake is that I kept on thinking that cross section ID is attribute of a panel data series. It is actually an object of the panel data workfile, in which all series have the same cross section ID.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Export group to Excel
Phil09 wrote:I also wish to know how to extract a particular data point from my panel data series X. For instance, I wish to assign the value of the series value at 2010Q2 for the cross section of "AK" to a scalar. How do I reference that data point?
There is no @elem for panels, unfortunately. You'll have to set the sample to the observation you want, then use @max or something to extract the value.
Follow us on Twitter @IHSEViews
Who is online
Users browsing this forum: No registered users and 6 guests