Page 1 of 1

Comparing series with missing values

Posted: Sun Dec 30, 2012 5:07 pm
by paues
I need to write an if statement that compares if some series are identical, but I am having some troubles with series that contain missing values. What I would like to write is this

Code: Select all

!error=0 for %s {%series} 'If all observations are identical in the two series (irrespective of whether those identical observations are missing or not) if {%s}<>_{%s} then !error=1 endif next
but that returns an error whenever a series contains a missing value. What to do?

Re: Comparing series with missing values

Posted: Mon Dec 31, 2012 2:37 am
by trubador
@eqna command does what you want, but you may need few more steps:

Code: Select all

... series comp = @eqna(y1,y2) if @min(comp)=0 then !error = 1 endif ...

Re: Comparing series with missing values

Posted: Mon Dec 31, 2012 3:18 am
by paues
Thank you! I tried using @eqna() directly in the if statement without success. I guess it only works on one observation at a time.