I have 2 alphaseries, A01 and A02 with roughly 2000 observations.
in A01 I have three strings, A, B and C.
I want to copy (or extract) the observation A02 (i) into a new series A03 provided A01 (i) = “A”; so far, this is not so difficult to manage; see my program – as a result, I get A03 with the observations from A02 as well as blank cells (where A01 doesn´t meet “A”)
alpha A03
smpl @all if A01 = “A”
A03 = A02
I just want to fill A03 from A03 (i) = 1, 2 etc. and leave out the blank cells.
how can I do this? I tried it also with a for loop and the if –function using @obs or @rows in A03 (i) like A03 (!obs) = A02 (!i) with !obs = @obs(A02)+1; I need to define A03 (i) which is obviously different from A02 (i).
I use eviews 7.1
copying (extracting) data from alphaseries
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: copying (extracting) data from alphaseries
You should probably use an SVECTOR rather than an ALPHA for A03.
Unfortunately I can't figure out/remember how to convert from one to the other easily, but this code should get you going:
Unfortunately I can't figure out/remember how to convert from one to the other easily, but this code should get you going:
Code: Select all
alpha temp
smpl if a01 = "A"
temp = a02
!len = @obssmpl
svector(!len) a03
!count = 1
for !i=1 to @obsrange
if temp(!i) <> "" then
a03(!count) = temp(!i)
!count = !count + 1
endif
next
Re: copying (extracting) data from alphaseries
thank you!
this works - I´ve got the svector with the observations from cell 1 through the last observation!
anyway, how can I count the number of observations in an alpha series (similar to @obs or @rows)?
this works - I´ve got the svector with the observations from cell 1 through the last observation!
anyway, how can I count the number of observations in an alpha series (similar to @obs or @rows)?
Who is online
Users browsing this forum: No registered users and 2 guests
