# How to write more efficient syntax with Logical Operator commands & string variables?

#### maggie1

##### New Member
Is there a shorter/more efficient syntax for Logical Operator Commands (AND, OR) with string variables? I always end up writing it out over and over again, which is very time consuming.

For example, below is there a way that I can only write INCOMESOURCE one time?

COMPUTE EMPLOYED=0.
IF (INCOMESOURCE = '001') OR (INCOMESOURCE = '005') OR (INCOMESOURCE = '006') OR (INCOMESOURCE = '037') OR (INCOMESOURCE = '098') EMPLOYED = 1.
EXECUTE.

Sorry if this is a very simple question. I'm a newish SPSS user and can't find the answer anywhere. Thanks so much!

#### helicon

##### Member
Re: How to write more efficient syntax with Logical Operator commands & string variab

Yes - use the logical function 'any':

Code:
comp employed = any(incomesource, '001','005','006','037','098').
exe.

#### grreee12

##### New Member
Re: How to write more efficient syntax with Logical Operator commands & string variab