Hi,
I'm trying to create a loop OLS regression for a set of 30 countries, but it keeps alerting me with error messages. I've read some manuals, but I still haven't worked out....
Take US for example
I have the independent variables like this: US_GDP, US_UNEMPLOYMENT, etc
I have dependent variable as: US_RATE
I'd like to repeat command US_RATE c US_GDP US_UNEMPLOYMENT for rest of 29 countries
How can I do that.....?
Sorry for this novice question, this is the first programming attempt for me....
Thank you!
Novice question: Loop
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13586
- Joined: Tue Sep 16, 2008 5:38 pm
-
popdycentral
- Posts: 7
- Joined: Tue May 20, 2014 4:55 am
Re: Novice question: Loop
Hi Gerah,
I've viewed that page many times before I posted the question, but my problem seems simpler than that...so I've tried to simply
put a string for my 30 countries
%country="us, uk,..."
then set an equations as
{%country}_RATE c {%country}_GDP {%country}_UNEMPLOYMENT
But it doesn't work...
I've viewed that page many times before I posted the question, but my problem seems simpler than that...so I've tried to simply
put a string for my 30 countries
%country="us, uk,..."
then set an equations as
{%country}_RATE c {%country}_GDP {%country}_UNEMPLOYMENT
But it doesn't work...
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13586
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Novice question: Loop
Try it without the commas.
-
popdycentral
- Posts: 7
- Joined: Tue May 20, 2014 4:55 am
Re: Novice question: Loop
sorry, the comma wasn't in my codes for eviews. The error says %country is not a valid string or scalar name.
I just want to repeat same regression for 30 countries.
they all have same dependent and independent variables corresponding to their own countries.
so my dataset is like:
us_rate, us_gdp, us_unemployment
uk_rate, uk_gdp, uk_unemployment
fr_rate, fr_gdp, fr_unemployment
.................
This is what I have done:
--------------------------------
%country="us uk fr"
{%country}_rate c {%country}_gdp {%country}_unemployment
--------------------------------
I just want to repeat same regression for 30 countries.
they all have same dependent and independent variables corresponding to their own countries.
so my dataset is like:
us_rate, us_gdp, us_unemployment
uk_rate, uk_gdp, uk_unemployment
fr_rate, fr_gdp, fr_unemployment
.................
This is what I have done:
--------------------------------
%country="us uk fr"
{%country}_rate c {%country}_gdp {%country}_unemployment
--------------------------------
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13586
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Novice question: Loop
You need to use a FOR loop to loop through the values in %country.
-
popdycentral
- Posts: 7
- Joined: Tue May 20, 2014 4:55 am
Re: Novice question: Loop
Hi, Thank you for the help.
I've worked it out. (It's simple but it took me some time..)
I;m wondering how I can add Newey-West options through the looping?
thanks.
I've worked it out. (It's simple but it took me some time..)
I;m wondering how I can add Newey-West options through the looping?
thanks.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13586
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Novice question: Loop
Estimate the equation via dialogs, then click on View->Representations to see what the command line form is.
Who is online
Users browsing this forum: No registered users and 2 guests
