Is there an @elem() commmand for panel data?

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

ech447
Posts: 5
Joined: Tue Jul 13, 2010 3:23 pm

Is there an @elem() commmand for panel data?

Postby ech447 » Wed Jul 28, 2010 10:09 am

Is there an @elem() commmand for panel data? Something like @elem(PX, * - 2006) that would return the 2006 value of PX for the UK when the computations were for the UK (one of the panel cross-sections) but use the 2006 value of PX for Spain (another) when the computations are for Spain? I use EViews 7.1, latest update. Thanks.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Is there an @elem() commmand for panel data?

Postby EViews Gareth » Wed Jul 28, 2010 10:23 am

No, although you can always set the sample equal to the observation you want, and then take the maximum of the series (the max of a single number is just that number):

Code: Select all

smpl 2006 2006 if country = "UK" !value = @max(px)

ech447
Posts: 5
Joined: Tue Jul 13, 2010 3:23 pm

Re: Is there an @elem() commmand for panel data?

Postby ech447 » Thu Jul 29, 2010 7:21 am

Thanks.
In terms of future EViews development, it would be useful to have such a command. Not infrequently we want to use indexes formed by, say, taking PX/@elem(PX,2002) for a standard time series. For panel data, I switch to a spreadsheet program for my computations. It would be nice to be able to just stay in EViews.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Is there an @elem() commmand for panel data?

Postby EViews Glenn » Thu Jul 29, 2010 9:34 am

Thanks for the suggestion. A couple of things.

First, your proposed syntax is interesting. One issue is that one could conceivably want the alternate definition of your @elem in which we return the cross-section value for the given year, as in

PX/@elem(PX,"UK")

That's all fine, but now the issue comes as to how to disambiguate the two approaches. One idea is to use @elem in the fashion that you suggested, and to add an @elemc or some other such function which returns the others. We'll give this some more thought.

One of the reasons we haven't added the particular function is that most things that we can think of can be done with little effort using current EViews tools. Note that you can (relatively) easily generate your indices in EViews. Expanding on Gareth's suggestion, first, you need to generate a series which has the 1996 values for each cross-section matched to each observation in a cross section. Once you have that, you can compute your index in the natural way:

Code: Select all

series pxscale = @maxsby(PX, @crossid, "1996 1996") series PX1 = PX / pxscale
You can combine this into a single statement if you'd like

Code: Select all

series PX1 = PX / @maxsby(PX, @crossid, "1996 1996")
You can wrap this in a subroutine if you wish, and even design an add-in to handle the front end input so that all you'd have to enter is the series name and the year/date.

Hope this helps. Thanks again for the suggestion.

andre
Posts: 2
Joined: Fri Aug 30, 2013 11:55 am

Re: Is there an @elem() commmand for panel data?

Postby andre » Fri Aug 30, 2013 12:12 pm

Following up on your suggestion. I would like to create an index relative to the date variables of an element in the panel. For example, a series GDP relative to the GDP of the United States for each year. Something like

"series y = 100*gdp/@(gdp, countrycode="USA", 1950 2000)."

This command would generate a series for US with "100" for all dates. For the other countries, it would generate GDP relative to the US for each year in the panel. How to do this?

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Is there an @elem() commmand for panel data?

Postby EViews Glenn » Fri Aug 30, 2013 12:57 pm

I think this will work (but you should double-check). The denominator computes the sums-by-year for GDP, but only for the specified country so that you'll get just the GDP for the US in each year

Code: Select all

series y = 100*gdp/@sumsby(gdp, year, "@all if countrycode=""USA""")

andre
Posts: 2
Joined: Fri Aug 30, 2013 11:55 am

Re: Is there an @elem() commmand for panel data?

Postby andre » Mon Sep 02, 2013 3:56 am

Yes! thank you.
I think this will work (but you should double-check). The denominator computes the sums-by-year for GDP, but only for the specified country so that you'll get just the GDP for the US in each year

Code: Select all

series y = 100*gdp/@sumsby(gdp, year, "@all if countrycode=""USA""")


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests