Using 'crossid' to name "panel units" (region)

For questions regarding programming in the EViews programming language.

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

Marc150
Posts: 10
Joined: Fri Mar 17, 2017 10:50 am

Using 'crossid' to name "panel units" (region)

Postby Marc150 » Fri Mar 17, 2017 11:28 am

Hi,
I am trying to create a panel data set, and I want to assign names to the regions for which I have data. My code looks something like this:

wfcreate(wf=annual) a 1981 2015 10
alpha region
if crossid=1 then
region=region_name
endif

However, this doesn't work to assign names to the region variable, as I would like, and I don't understand why. What's strange is that if I create some other series, say q, assign it some arbitrary value, and use it in lieu of 'region', then the code works fine. However, that does not work if, rather than assigning it an arbitrary value, I set it equal to crossid.

Thanks,
Marc

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

Re: Using 'crossid' to name "panel units" (region)

Postby EViews Gareth » Fri Mar 17, 2017 11:30 am

Code: Select all

wfcreate(wf=annual) a 1981 2015 10 alpha region smpl if crossid=1 then region="region_name" endif

Marc150
Posts: 10
Joined: Fri Mar 17, 2017 10:50 am

Re: Using 'crossid' to name "panel units" (region)

Postby Marc150 » Fri Mar 17, 2017 11:49 am

Thanks Gareth. Sorry if I'm missing something, but when I try that I get the error message "endif found outside of loop or IF statement".

Marc150
Posts: 10
Joined: Fri Mar 17, 2017 10:50 am

Re: Using 'crossid' to name "panel units" (region)

Postby Marc150 » Fri Mar 17, 2017 2:02 pm

Nvm. Thanks, again.

FYI (for anyone else reading this), the code that works is

wfcreate(wf=annual) a 1981 2015 10
alpha region
smpl if crossid=1
region="region_name"


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests