Hello...ive been stuck on this for ages it seems...
I have 24 regression estimates for a variable "d". (one for each hour of the day). I have string variables for each estimate:
%est_1 = "d c dd^5 dd^6 dd^7 dd^9 dd^12"
%est_2 = "d te dd^2 dd^7"
%est_3 = "d c te te^2 dd^5 dd^6" ...etc etc
the below regression works for hour 1.
%estimate = %est_1
myequation.ls {%estimate}
but I want be able to choose the hour like so:
%hour = "1"
%estimate = "est_" + %hour
myequation.ls {%estimate}
this gives me an error message. "est_1 is not defined in "DO_myEquation.ls est_1"
Can you please help me solve this problem?
Kind Regards
Minson
correct string form for running regression
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13600
- Joined: Tue Sep 16, 2008 5:38 pm
Re: correct string form for running regression
Unfortunately you can't use a string variable to refer to another string variable like that.
You might have better luck putting the strings into a table. Something like:
Then inside the loop you could do something like:
I think that would work....
You might have better luck putting the strings into a table. Something like:
Code: Select all
table estimates
estimates(1,1) = "d c dd^5 dd^6 dd^7 dd^9 dd^12"
estimates(2,1) = "d te dd^2 dd^7"
estimates(3,1) = "d c te te^2 dd^5 dd^6" ...etc etc
Code: Select all
%estimate = estimates(!i,1)
myequation.ls {%estimate}
-
j.galimberti
- Posts: 26
- Joined: Fri Feb 06, 2009 2:53 am
Re: correct string form for running regression
What happens if you try this:
%hour = "1"
%estimate = {"est_"+%hour}
myequation.ls {%estimate}
%hour = "1"
%estimate = {"est_"+%hour}
myequation.ls {%estimate}
Galimberti, J. K.
MSc in Economics at Federal University of Santa Catarina (Brazil)
Going to PhD in Economics at University of Manchester (UK)
Website: http://sites.google.com/site/jkgeconoeng/
MSc in Economics at Federal University of Santa Catarina (Brazil)
Going to PhD in Economics at University of Manchester (UK)
Website: http://sites.google.com/site/jkgeconoeng/
Re: correct string form for running regression
Thanks Gareth, the table work really well.
J.Galimberti: I tried your suggestion, but unfortunately it didn't work. I got the error message:
" "est_" + %hour is not a valid string or automatic scalar name in %estimate = {"est_" + %hour} "
Thank you both for your suggestions.
Regards
Minson
J.Galimberti: I tried your suggestion, but unfortunately it didn't work. I got the error message:
" "est_" + %hour is not a valid string or automatic scalar name in %estimate = {"est_" + %hour} "
Thank you both for your suggestions.
Regards
Minson
Who is online
Users browsing this forum: No registered users and 2 guests
