Setting up Panel workfile
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
Setting up Panel workfile
Hello. I am a beginner at Eviews and currently using Eviews 7. I am trying to set up a panel work file. My data consist of 7 countries and 10 years.
For each country, I have different number of companies. The problem I am encountering is that for a country say UK I have 20 companies and 10 different years so each company has 10 different observations and the country UK has 200 observations altogether. Similarly, for another country say US I have 500 companies and 10 different year observations and so on. I am trying to run a panel regression with all the countries included but for each country I have repeated years e.g. the year 2000 for 20 companies for UK and the next year. I have tried exporting the data into Eviews and resizing it to panel but it doesn’t work at all. I get error messages such as
-Indices do not uniquely identify observations
- duplicates found..
It also provides me with the option to create cellid series which when I press yes gives me a 3 dimension unbalanced undated panel. I need to structure my panel data correctly in order to do the analysis. If I am not being clear then I have attached the panel data I have set up in Excel. Any advice on where I ma going wrong would be much appreciated.
Thank you.
For each country, I have different number of companies. The problem I am encountering is that for a country say UK I have 20 companies and 10 different years so each company has 10 different observations and the country UK has 200 observations altogether. Similarly, for another country say US I have 500 companies and 10 different year observations and so on. I am trying to run a panel regression with all the countries included but for each country I have repeated years e.g. the year 2000 for 20 companies for UK and the next year. I have tried exporting the data into Eviews and resizing it to panel but it doesn’t work at all. I get error messages such as
-Indices do not uniquely identify observations
- duplicates found..
It also provides me with the option to create cellid series which when I press yes gives me a 3 dimension unbalanced undated panel. I need to structure my panel data correctly in order to do the analysis. If I am not being clear then I have attached the panel data I have set up in Excel. Any advice on where I ma going wrong would be much appreciated.
Thank you.
- Attachments
-
- panel_test29.xlsx
- (1.76 MiB) Downloaded 609 times
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Setting up Panel workfile
You have a three dimensional panel. EViews does support three dimensional panels, in that you can bring the data in as a panel workfile. However it doesn't support panel estimation methods in 3D panels.
To bring it in as a panel, simply tell EViews that it is a Dated Panel, with "country_id company_id" as the cross-section ID, and "year" as the time id.
To bring it in as a panel, simply tell EViews that it is a Dated Panel, with "country_id company_id" as the cross-section ID, and "year" as the time id.
Re: Setting up Panel workfile
Thank you for your prompt reply.
I followed your instructions and it worked. However, since I can't use the panel options in 3d I decided to take the company Id and just work with country Id as my cross-sectional identifier. However, when I import my data into Eviews now, it says I have repeated values and therefore cannot use panel. Do you have any suggestion as to how I could overcome this problem? I have tried the method outlined in http://forums.eviews.com/viewtopic.php?f=7&t=74 but I get an error message.
Any advice would be appreciated.
Thank you.
I followed your instructions and it worked. However, since I can't use the panel options in 3d I decided to take the company Id and just work with country Id as my cross-sectional identifier. However, when I import my data into Eviews now, it says I have repeated values and therefore cannot use panel. Do you have any suggestion as to how I could overcome this problem? I have tried the method outlined in http://forums.eviews.com/viewtopic.php?f=7&t=74 but I get an error message.
Any advice would be appreciated.
Thank you.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Setting up Panel workfile
The error is pretty fundamental.
You need a cross-section and time identifier that can uniquely identify each observation. You currently don't have that.
You need a cross-section and time identifier that can uniquely identify each observation. You currently don't have that.
Re: Setting up Panel workfile
Thank you for your reply. How can I do that though? I have tried identifying each year with one number but that doesn't work. Same with the country. Is there any other way I can identify them uniquely?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Setting up Panel workfile
You're thinking of "how do I do this in EViews", when you should be thinking more along the lines of "what am I doing in general?". Your data is not a two-way panel. It is a three-way panel. You do not have one observation for each country for each year. You have multiple observations for each country for each year. Until you figure out how to have only one observation for each country for each year, you cannot have a two-way panel.
-
neptunhiker
- Posts: 50
- Joined: Sat Oct 20, 2012 7:30 am
Re: Setting up Panel workfile
Hi Gareth,
I think I might be in the appropriate post here, since I believe I have a similar problem. I am trying to set up a panel structure for my data. I am aware that I will need a date series and a cross section identifier series. I have created a date series through
which works fine. Now, I would like to create identifier series so that I can later set up my panel structure. I just don't want to do it manually, because I have a lot of data. The names of the time series that are in my workfile all share a few characters followed by a unique id. For example: I have three series in my workfile with the names "TTT_8", "TTT_4" and "TTT_12". Out of these three series I would like to create alpha series that contain only the id, i.e. "8", "4" or "12". If I had these, I would be able to stack these 3 alpha series on top of each other, so that I can create one alpha series containing all three ids. After that I can restructure my workfile via Proc-->Structure/Resize Current Page as a dated panel using a stacked data series as "date series" and the alpha series containing all three ids as "cross section id series".
To summarize: is there a way to extract the name of a time series into an alpha series?
Thank you very much.
I think I might be in the appropriate post here, since I believe I have a similar problem. I am trying to set up a panel structure for my data. I am aware that I will need a date series and a cross section identifier series. I have created a date series through
Code: Select all
series date=@dateTo summarize: is there a way to extract the name of a time series into an alpha series?
Thank you very much.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Setting up Panel workfile
alpha a = series.@name
-
neptunhiker
- Posts: 50
- Joined: Sat Oct 20, 2012 7:30 am
Re: Setting up Panel workfile
Hi Gareth,
thank you. That was easy and it works fine. One more question though. What do I need to do, when I only want to extract part of the name of a series. Considering my previous example, I would like to extract only the id and not the entire name; i.e. from the series "TTT_8", "TTT_4" and "TTT_12" I would like to only extract "8", "4" and "12". By applying your solution I would extract the entire name by doing the following:
I thought about a solution, and came up with this idea:
That works out fine as long as the IDs of my series always start at character position number 5. But, unfortunately that will not always be the case in my data set. I will work with series that have a varying number of characters before the actual IDs start and also the lengths of the IDs are not equal. This is what it could look like:
TTT_8
TTT_4
TTT_12
TTT_ABC_7h56
ABC_TTT_34h57
Is there any way to extract only the IDs that follow after the last underscore, because that is what all series have in common - a unique ID (of different length) after the last underscore. Thanks again for your help.
thank you. That was easy and it works fine. One more question though. What do I need to do, when I only want to extract part of the name of a series. Considering my previous example, I would like to extract only the id and not the entire name; i.e. from the series "TTT_8", "TTT_4" and "TTT_12" I would like to only extract "8", "4" and "12". By applying your solution I would extract the entire name by doing the following:
Code: Select all
alpha id1=TTT_8.@name
alpha id2=TTT_4.@name
alpha id3=TTT_12.@name
Code: Select all
alpha id1=@mid(TTT_8.@name,5)
alpha id2=@mid(TTT_4.@name,5)
alpha id3=@mid(TTT_12.@name,5)
TTT_8
TTT_4
TTT_12
TTT_ABC_7h56
ABC_TTT_34h57
Is there any way to extract only the IDs that follow after the last underscore, because that is what all series have in common - a unique ID (of different length) after the last underscore. Thanks again for your help.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Setting up Panel workfile
Use the @instr function to find the position of the _
-
neptunhiker
- Posts: 50
- Joined: Sat Oct 20, 2012 7:30 am
Re: Setting up Panel workfile
Hi Gareth,
thanks a lot. Like always you showed me the way. This is what I came up with:
Looks complicated? Well, it is. That's what I have done: I replaced the underscores in the names of the series by spaces (@replace), so that I could next count the number of words in the so created string (@wcount). The number of words minus one gives me the integer of the last underscore (the one right before the id starts). Using that integer I could use the @instr function to find the position of the last underscore. Using that position plus one I was able to use the @mid function to extract only the ID. It works, but it's not really a straight forward solution. What I am looking for is a function that gives out the integer of the number of a certain character in a string. Or even better: a function that gives out the position of the last apearance of a certain character (i.e. underscore).
To summarize: I would like to reduce my above solution, so that it looks kind of like this:
Thanks a lot in advance.
thanks a lot. Like always you showed me the way. This is what I came up with:
Code: Select all
alpha id1=@mid(ttt_8.@name,@instr("ttt_8","_",(@wcount(@replace("ttt_8","_"," "))-1))+1)
alpha id2=@mid(ttt_4.@name,@instr("ttt_4","_",(@wcount(@replace("ttt_4","_"," "))-1))+1)
alpha id3=@mid(ttt_12.@name,@instr("ttt_12","_",(@wcount(@replace("ttt_12","_"," "))-1))+1)
alpha id4=@mid(ttt_ABC_7h56.@name,@instr("ttt_ABC_7h56","_",(@wcount(@replace("ttt_ABC_7h56","_"," "))-1))+1)
alpha id5=@mid(ABC_TTT_34h57.@name,@instr("ABC_TTT_34h57","_",(@wcount(@replace("ABC_TTT_34h57","_"," "))-1))+1)
To summarize: I would like to reduce my above solution, so that it looks kind of like this:
Code: Select all
alpha id5=@mid(ABC_TTT_34h57.@name,@instr("ABC_TTT_34h57","_",[integer of last underscore])+1)
Who is online
Users browsing this forum: No registered users and 2 guests
