Make the @first function properly taking account of panel data

For making suggestions and/or requests for new features you'd like added to EViews.

Moderators: EViews Gareth, EViews Moderator

mamo
Posts: 205
Joined: Wed Nov 07, 2012 9:11 am

Make the @first function properly taking account of panel data

Postby mamo » Fri Feb 14, 2025 3:10 am

Dear EViews team,
I am using EViews 14
I suggest that you improve the @first(x) function to work proper in panels so that it allows for showing the first value of series x in each cross section in the preselected sample. To give an example, I would like to have an easy function which would show the value 4040 for x in the lines 2 - 20- until 2 -24- rather than the value 2020 in the program below.
Ideally, you would allow for an additional argument to the function @first to indicate the cross-sectional variable. So in the example below @first(x,"2020 2024", crossid) would show 4040 from 2 -20- onwards, whereas @first(x) would work as it does currently. Likewise, in panels with more than one cross ids, you would also implement @first such as to allow for @first(x, "2020 2024", crossid1, crossid2).
Best, mamo

Code: Select all

wfcreate a 2000 2024 2 series x=crossid*@year smpl 2020 2024 show x @first(x)
p1.png
p1.png (13.04 KiB) Viewed 47830 times

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

Re: Make the @first function properly taking account of panel data

Postby EViews Gareth » Fri Feb 14, 2025 8:51 am

@first returns a scalar, which is why it cannot be used to do what you want.

EViews Matt
EViews Developer
Posts: 583
Joined: Thu Apr 25, 2013 7:48 pm

Re: Make the @first function properly taking account of panel data

Postby EViews Matt » Fri Feb 14, 2025 12:19 pm

Hello,

The function you describe already exists: @firstsby. For your example, I believe "@firstsby(x, @crossid)" would produce the results you want.

mamo
Posts: 205
Joined: Wed Nov 07, 2012 9:11 am

Re: Make the @first function properly taking account of panel data

Postby mamo » Fri Feb 21, 2025 7:27 am

Dear Eviews Matt,
many thanks, indeed this works!
My suggestion would be include a reference to the documentation of @firstsby into the index so that it can be found easily.
Same applies to @lastsby
firstsby.png
firstsby.png (11.63 KiB) Viewed 39839 times
Best, mamo


Return to “Suggestions and Requests”

Who is online

Users browsing this forum: No registered users and 1 guest