loop through series in a panel

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

dsdsdsdsd
Posts: 21
Joined: Sun Sep 06, 2020 7:33 pm

loop through series in a panel

Postby dsdsdsdsd » Wed Sep 09, 2020 7:43 am

hello ...

I am very new with eViews ...

I have setup a panel workfile ... from 1980-2020 ... with 37 observations (countries) ...

so I imported an excel sheet (datasrc_countries) with the list of 37 countries (the list of 37 does not match up with the workfile size = 40x37) ...

now I want to properly assign to each stack within the workfile series COUNTRY, the appropriate country name which comes from the imported series DATASRC_COUNTRY ...

my plan is to iterate through the list of 37, and then apply a @recode based on CROSSID ... I need a way to pull each item from the DATASRC_COUNTRY series ... I tried
@elem( datasrc_country , @Str( !j ) )
and thus get an error: Date does not uniquely define observation in panels in .... I understand that the @elem does not work for panel data.

in the eviews.com/help, I do not see a panel-related function to pull elements out ..

- any thoughts?

- thanks, Shannon

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

Re: loop through series in a panel

Postby EViews Gareth » Wed Sep 09, 2020 7:57 am

Perhaps you could describe (or even better, provide the files) the situation a bit better. I'm struggling to see exactly what you're trying to do.
Follow us on Twitter @IHSEViews

dsdsdsdsd
Posts: 21
Joined: Sun Sep 06, 2020 7:33 pm

Re: loop through series in a panel

Postby dsdsdsdsd » Wed Sep 09, 2020 8:34 am

in the group window on the right you can see the top "stack", from "1 - 80" to "1 - 19" ... ofcourse that is part of a repeating pattern: "1 - 80" to "1 - 20" ... "37 - 80" to "37 - 20" ...

my intent is to:

Code: Select all

COUNTRY=@recode( CROSSID=!j , datasrc_country{ @Str( !j ) } , "foobar" )
'inside a for loop

such that in the 1-stack I should have COUNTRY => "AUSTRALIA", and the 2-stack I should have COUNTRY => "AUSTRIA", etc ...

screenshot_eviews.png
screenshot_eviews.png (272.04 KiB) Viewed 7913 times

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

Re: loop through series in a panel

Postby EViews Gareth » Wed Sep 09, 2020 9:31 am

Bring the country names into a new page, not the panel page.
Then copy the names over from that new page to the panel, using general match merge.
Follow us on Twitter @IHSEViews

dsdsdsdsd
Posts: 21
Joined: Sun Sep 06, 2020 7:33 pm

Re: loop through series in a panel

Postby dsdsdsdsd » Wed Sep 09, 2020 9:52 am

ok... I will try that, but may I ask, please, is it possible to do it as I was attempting? I suppose this is really a question of: is it possible to iterate down a column in a panel?

- thanks ... I will update when I get the multi page effort to work ...

dsdsdsdsd
Posts: 21
Joined: Sun Sep 06, 2020 7:33 pm

Re: loop through series in a panel

Postby dsdsdsdsd » Wed Sep 09, 2020 10:44 am

I am using copy to match merge ... but the src page does not have an id ... I looked under properties and options, but I couldn't find anything ... is there a default id name?

Code: Select all

copy(options) wf_src::pg_src\datasrc_country  wf_dest::pg_dest\country   ???  crossid


screenshot_eviews_2.png
screenshot_eviews_2.png (273.81 KiB) Viewed 7900 times

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

Re: loop through series in a panel

Postby EViews Gareth » Wed Sep 09, 2020 11:09 am

Create one.

Code: Select all

series myid = @trend+1
Follow us on Twitter @IHSEViews

dsdsdsdsd
Posts: 21
Joined: Sun Sep 06, 2020 7:33 pm

Re: loop through series in a panel

Postby dsdsdsdsd » Wed Sep 09, 2020 5:07 pm

that worked ...

thanks


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 31 guests