Loop with creating series

For questions regarding programming in the EViews programming language.

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

robbieboy74
Posts: 4
Joined: Sat Feb 12, 2011 7:17 pm

Loop with creating series

Postby robbieboy74 » Wed Mar 09, 2011 11:40 pm

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

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

Re: Loop with creating series

Postby EViews Gareth » Thu Mar 10, 2011 8:28 am

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

Postby robbieboy74 » Thu Mar 10, 2011 10:04 am

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

Postby tchaithonov » Thu Mar 10, 2011 10:30 am

Just do this (remove the first line if you have a workfile opened already):

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
This creates 7 dummy series named dum_mon, dum_tue, dum_wed, etc. It should do what you are trying to accomplish.

Tchaithonov


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest