how to calculte the number of different obs in a series

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

xubin1988
Posts: 6
Joined: Tue Oct 04, 2011 4:51 pm

how to calculte the number of different obs in a series

Postby xubin1988 » Wed Jul 04, 2012 8:17 am

for example, i have a series: {1,1,2,3,4,5,6,6}
the observation number of this series is 8, which I think can be retrieved by the function of @obs
but the number of different variables in this series is 6

how to achieve the second purpose by the functions in eview?

Thanks in advance !!!

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

Re: how to calculte the number of different obs in a series

Postby EViews Gareth » Wed Jul 04, 2012 9:58 am

Open the series, and then choose View->One Way Tabulation.

xubin1988
Posts: 6
Joined: Tue Oct 04, 2011 4:51 pm

Re: how to calculte the number of different obs in a series

Postby xubin1988 » Wed Jul 04, 2012 10:06 am

Open the series, and then choose View->One Way Tabulation.
hey thanks for answering!
how one way tabulation can cont the different numbers in a series?
and i have so many series to do this manipulation
so do you know how to run this count by evews functions?

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

Re: how to calculte the number of different obs in a series

Postby EViews Gareth » Wed Jul 04, 2012 11:03 am

There is no function that will return the number of unique values in a series. You can easily see the number of unique values with a one-way tabulation, though.

To perform one-way tabulation in a program, you can use series.freq

xubin1988
Posts: 6
Joined: Tue Oct 04, 2011 4:51 pm

Re: how to calculte the number of different obs in a series

Postby xubin1988 » Wed Jul 04, 2012 11:53 am

There is no function that will return the number of unique values in a series. You can easily see the number of unique values with a one-way tabulation, though.

To perform one-way tabulation in a program, you can use series.freq
hi,

i see how to use one way tabulation to count unique number now

can you tell me how to conduct such operation by functions?

I think there would be a function if i can use it by clicking mouse

xubin1988
Posts: 6
Joined: Tue Oct 04, 2011 4:51 pm

Re: how to calculte the number of different obs in a series

Postby xubin1988 » Wed Jul 04, 2012 11:54 am

There is no function that will return the number of unique values in a series. You can easily see the number of unique values with a one-way tabulation, though.

To perform one-way tabulation in a program, you can use series.freq
or can you figure out a code to solve my problem?

thanks in advance!!

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

Re: how to calculte the number of different obs in a series

Postby EViews Gareth » Wed Jul 04, 2012 12:31 pm

To perform one-way tabulation in a program, you can use series.freq

CharlieEVIEWS
Posts: 202
Joined: Tue Jul 17, 2012 9:47 am

Re: how to calculte the number of different obs in a series

Postby CharlieEVIEWS » Thu Sep 10, 2015 10:27 am

Lot of views on this thread so I thought I'd post:

Code: Select all

freeze(seriesfreq) myseries.freq scalar numberunique = @val(@mid(seriesfreq(5,1),22))
Should do the trick. Works for alphas too.

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

Re: how to calculte the number of different obs in a series

Postby EViews Gareth » Thu Sep 10, 2015 10:37 am

Since this thread was originally posted, the @uniquevals function was added to EViews. Much easier to use that programmatically.

CharlieEVIEWS
Posts: 202
Joined: Tue Jul 17, 2012 9:47 am

Re: how to calculte the number of different obs in a series

Postby CharlieEVIEWS » Thu Sep 10, 2015 10:56 am

i need there to be a ::facepalm:: smilie. still might come in useful for somebody one day though.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 1 guest