Number of observations for common sample in group

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

neptunhiker
Posts: 50
Joined: Sat Oct 20, 2012 7:30 am

Number of observations for common sample in group

Postby neptunhiker » Tue Apr 08, 2014 9:40 am

Hi,

I would like to determine the number of common observations for two series. My idea is to group them and then use view/descriptive stats/common sample. Then I get exactly what I am looking for. I would like to do the same in a program, but I can't seem to figure out how to do it. In the help file I found the option @obsby, but I don't understand how to use it, if it's even the right choice.

Here is an example workfile, for which the common sample includes 99 observations. How can I extract these 99 observations using a program code? Thank you very much in advance for help.

Code: Select all

wfcreate u 100 series a=@rnorm series b=@rnorm a(23)="NA" group g a b

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

Re: Number of observations for common sample in group

Postby EViews Gareth » Tue Apr 08, 2014 9:47 am

add a line:

Code: Select all

smpl if @robs(g) = g.@count
That sets the sample to be only observations for which both series have values. Then you can use @obssmpl to return the number of observations, etc...

neptunhiker
Posts: 50
Joined: Sat Oct 20, 2012 7:30 am

Re: Number of observations for common sample in group

Postby neptunhiker » Tue Apr 08, 2014 9:43 pm

Thank you Gareth. It works out perfectly.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests