# Excluding observations from the sample (data-file)

Hi all, I’m running a regression analysis. Unfortunately, I recognized that some of the observations are associated with errors, and I want to exclude these observations from the regression. The criterion I want to use in an exclusion of observations is that the sum of three of the variables in the sample is zero, i.e.: I want to exclude observations from the regression which fulfills the criterion; x1 + x2 + x3 = 0. I do NOT want to exclude variables, only observations which fulfill the criterion. Question: Is it possible to use a Shazam-code to solve the problem. I looked into the SKIPIF-command but couldn’t find a way out of it.

Best regards!

edit retag close merge delete

( 2013-09-16 05:45:41 +0000 )edit

Sort by » oldest newest most voted

Likely this is because the SET SKIP command was not used before using the SKIPIF command. This is required to switch on SKIPIF usage.

After that you can then use SKIPIF(expression) where expression may use arithmetic or logical operators such as those described for the GENR and IF commands.

Examples include:

skipif (x3+x4.eq.x5)
skipif (x3.gt.x12)
skipif ((x4.eq.0).or.(x5.eq.0))
skipif (time(0).eq.6)
skipif (x1)
skipif (lag(x2+3)/12-x4)
skipif (province.eq."manitoba")
skipif (abs(x3+x4-x5).le.0.0001)


Further details can be found in the chapters on Generating Variables and Set and Display.

more