Page 1 of 1

Number of observations for common sample in group

Posted: Tue Apr 08, 2014 9:40 am
by neptunhiker
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

Re: Number of observations for common sample in group

Posted: Tue Apr 08, 2014 9:47 am
by EViews Gareth
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...

Re: Number of observations for common sample in group

Posted: Tue Apr 08, 2014 9:43 pm
by neptunhiker
Thank you Gareth. It works out perfectly.