Hi,
I'm trying to get the number of observations in an alpha series but I keep getting the error message: Alpha sent to function which operates on a matrix:
WfCreate(wf=unstruct, page=test) u 10
Alpha aAlphaSeries = "A"
!iK = @Last(aAlphaSeries)
!iK = @Obs(aAlphaSeries)
/Erik.
Number of observations in alpha series
Moderators: EViews Gareth, EViews Moderator
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Number of observations in alpha series
Try alpha.@first or alpha.@last
Follow us on Twitter @IHSEViews
Re: Number of observations in alpha series
Hi,
It works but I must say the code could be improved.... I have an alpha series called "a" with 21 observations of which the 21st is empty/missing.
a.@first returns the string 21 - I would expect a string with the first observation
a.@last returns the string 20 - I would expect a string with the last observation, or an integer containing the index of the last non-missing observation
a.@obs returns 0 - I would like it to return the number of non-missing observations.
I am working in an unstructured/undated workfile, I guess it might work differently in a dated workfile.
/Erik.
It works but I must say the code could be improved.... I have an alpha series called "a" with 21 observations of which the 21st is empty/missing.
a.@first returns the string 21 - I would expect a string with the first observation
a.@last returns the string 20 - I would expect a string with the last observation, or an integer containing the index of the last non-missing observation
a.@obs returns 0 - I would like it to return the number of non-missing observations.
I am working in an unstructured/undated workfile, I guess it might work differently in a dated workfile.
/Erik.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Number of observations in alpha series
I can't replicate this. Could you post an example?
Follow us on Twitter @IHSEViews
Re: Number of observations in alpha series
Neither can I it seems for the @first function! I'm slightly confused now because I'm pretty sure it returned 21, but I guess I was mistaken.
Nevertheless @obs returns zero - as in the example below, but that's not a big problem, I'll just avoid that function when dealing with alphas.
Nevertheless @obs returns zero - as in the example below, but that's not a big problem, I'll just avoid that function when dealing with alphas.
Code: Select all
WfCreate(wf=unstruct, page=test) u 5
Alpha a
a(1) = "C"
a(2) = "D"
a(3) = "E"
a(4) = "F"
!obs = a.@obs
@UiPrompt(@Str(!obs))
Re: Number of observations in alpha series
Hi again,
It would be nice if the @obs function did work, since @last will not give a currect number of non-missing observations if the alpha series has 'holes' in it.
/Erik.
It would be nice if the @obs function did work, since @last will not give a currect number of non-missing observations if the alpha series has 'holes' in it.
/Erik.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Number of observations in alpha series
I'll see that it gets added for the next version.
Follow us on Twitter @IHSEViews
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Number of observations in alpha series
ok, I added support for the @obs data member on alpha series into EViews 8. Next patch should have it.
I'll also add support for the @obs() function for EViews 9.
I'll also add support for the @obs() function for EViews 9.
Follow us on Twitter @IHSEViews
Re: Number of observations in alpha series
Great, thanks!
Re: Number of observations in alpha series
Hi,
One follow up question that is related: How do I store the number of observations of a alpha series as a series?
I tried:
series count=alpha.@obs
but the count shows all 0.
Any idea?
Thanks,
BC
One follow up question that is related: How do I store the number of observations of a alpha series as a series?
I tried:
series count=alpha.@obs
but the count shows all 0.
Any idea?
Thanks,
BC
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Number of observations in alpha series
Code: Select all
create u 100
smpl if nrnd<1.5
alpha a = "hello world"
smpl @all
series count = a.@obs
show count
Follow us on Twitter @IHSEViews
Who is online
Users browsing this forum: No registered users and 23 guests