take a look at the example syntax below.
Note that I changed the symbolic operator "=" to the conventional
operator "eq". Over the years I have seen many people confuse
themselves by not making this distinction.
Also why do you have sysmis in your data? A good data handling practice
is to redraft your syntax until there are no system missing values.
Again a result of having seen many people shoot themselves in the foot
by failing to do this.
*** if it is from poor syntax on reading that is easily fixed with the
SET command as in the second set of syntax.
*** If it is due to data transformations you should trap the condition
that results in an instruction the software cannot obey. Assign a user
missing value.
this is an example of a generic trap.
do if x lt 0 .
compute result = -99999.
else if missing(x).
compute result = -99998
else.
compute result= sqrt(x).
end if.
missing values result( lo thru -90000).
value labels result
-99999 'x was zero'
-99999 'x was missing'.
*** syntax for original post.
* with input data not yet clean.
new file.
data list list/ Id(f2) g1(f1)a1(f1).
begin data
01 1
02 2
03 1 1
04 1 1
end data.
compute check1=0.
if ((G1 eq 1 or G1 eq 2) AND A1=$SYsMIS) check1=1.
FREQUENCIES check1.
* with input data clean.
new file.
set blanks =0.
data list list/ Id(f2) g1(f1)a1(f1).
begin data
01 1
02 2
03 1 1
04 1 1
end data.
compute check1=0.
if ((G1 eq 1 or G1 eq 2) AND A1=0) check1=1.
FREQUENCIES check1.
Art Kendall
Social Research Consultants