Hello,
is it possible to create many different series using a loop?
I tried using a loop to create seasonal dummies, but i am having trouble. It only creates one, and it turns out wrong.
If, for example, you have daily data, and you want weekday, why doesnt this work?
for !i = 1 to 7
genr series(!i) = @weekday=!i
next
Loop with creating series
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Loop with creating series
If only there was some sort of introduction to programming that covered this sort of thing.
-
robbieboy74
- Posts: 4
- Joined: Sat Feb 12, 2011 7:17 pm
Re: Loop with creating series
I already read that and I don't get it. I am not a programmer. All the codes I write don't run. But thanks for the pernicious sarcasm, it really makes it likely this forum will used again.
-
tchaithonov
- Posts: 168
- Joined: Mon Apr 13, 2009 7:39 am
- Location: New York City
Re: Loop with creating series
Just do this (remove the first line if you have a workfile opened already):
This creates 7 dummy series named dum_mon, dum_tue, dum_wed, etc. It should do what you are trying to accomplish.
Tchaithonov
Code: Select all
wfcreate d7 1/1/2011 3/10/2011
group dummies @expand(@weekday)
%weekdays = "Mon Tue Wed Thu Fri Sat Sun"
for !i = 1 to 7
%weekday = @word(%weekdays,!i)
%dum = dummies.@seriesname(!i)
series dum_{%weekday} = {%dum}
next
Tchaithonov
Who is online
Users browsing this forum: No registered users and 2 guests
