loop problem
Posted: Thu Apr 18, 2013 8:07 am
Hi everybody,
i'm using eviews 7 and have a problem with the following.
I need to create an alpha object land_abk that contains the values A, B, ..., J. One alpha object land_name that contains the values "Republik A", "Republik B", ... , "Republik J". And one series object d_member containing the value 0 for the first 5 observations and 1 for the last 5 observations.
I got the right answer, but I'm not sure if I really understand what I am doing there.
pagecreate(page=land) u 10
alpha land_abk
alpha land_name
series d_member=0
d_member.setformat f.0
!i = 1
for %ctr A B C D E F G H I J
smpl !i !i
land_abk = %ctr
land_name = "Republik "+%ctr
if !i > 5 then
d_member = 1
endif
!i =!i + 1
next
sample@all
I have difficulties with the FOR loop. Generally I understand what to do, but what does that "smpl !i !i" (= smpl 1 1?) and that "!i = !i+1" mean?
thanks for your help!
i'm using eviews 7 and have a problem with the following.
I need to create an alpha object land_abk that contains the values A, B, ..., J. One alpha object land_name that contains the values "Republik A", "Republik B", ... , "Republik J". And one series object d_member containing the value 0 for the first 5 observations and 1 for the last 5 observations.
I got the right answer, but I'm not sure if I really understand what I am doing there.
pagecreate(page=land) u 10
alpha land_abk
alpha land_name
series d_member=0
d_member.setformat f.0
!i = 1
for %ctr A B C D E F G H I J
smpl !i !i
land_abk = %ctr
land_name = "Republik "+%ctr
if !i > 5 then
d_member = 1
endif
!i =!i + 1
next
sample@all
I have difficulties with the FOR loop. Generally I understand what to do, but what does that "smpl !i !i" (= smpl 1 1?) and that "!i = !i+1" mean?
thanks for your help!