Number of observations in alpha series

For notifying us of what you believe are bugs or errors in EViews.
Please ensure your copy of EViews is up-to-date before posting.

Moderators: EViews Gareth, EViews Moderator

ErikG
Posts: 48
Joined: Wed Jan 23, 2013 1:18 am

Number of observations in alpha series

Postby ErikG » Mon Sep 01, 2014 7:14 am

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.

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

Re: Number of observations in alpha series

Postby EViews Gareth » Tue Sep 02, 2014 8:11 am

Try alpha.@first or alpha.@last
Follow us on Twitter @IHSEViews

ErikG
Posts: 48
Joined: Wed Jan 23, 2013 1:18 am

Re: Number of observations in alpha series

Postby ErikG » Wed Sep 03, 2014 4:46 am

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.

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

Re: Number of observations in alpha series

Postby EViews Gareth » Wed Sep 03, 2014 12:10 pm

I can't replicate this. Could you post an example?
Follow us on Twitter @IHSEViews

ErikG
Posts: 48
Joined: Wed Jan 23, 2013 1:18 am

Re: Number of observations in alpha series

Postby ErikG » Thu Sep 04, 2014 3:36 am

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.

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))

ErikG
Posts: 48
Joined: Wed Jan 23, 2013 1:18 am

Re: Number of observations in alpha series

Postby ErikG » Fri Sep 05, 2014 5:46 am

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.

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

Re: Number of observations in alpha series

Postby EViews Gareth » Fri Sep 05, 2014 8:29 am

I'll see that it gets added for the next version.
Follow us on Twitter @IHSEViews

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

Re: Number of observations in alpha series

Postby EViews Gareth » Fri Sep 05, 2014 9:17 am

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.
Follow us on Twitter @IHSEViews

ErikG
Posts: 48
Joined: Wed Jan 23, 2013 1:18 am

Re: Number of observations in alpha series

Postby ErikG » Mon Sep 08, 2014 12:21 am

Great, thanks!

bcchen
Posts: 22
Joined: Tue May 02, 2017 8:34 am

Re: Number of observations in alpha series

Postby bcchen » Thu Jun 15, 2017 6:20 pm

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

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

Re: Number of observations in alpha series

Postby EViews Gareth » Thu Jun 15, 2017 9:33 pm

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


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 3 guests