Thursday, April 3, 2008

Special WHERE

Use special operators in the WHERE statement to subset data.

LIKE selects observations by comparing character values to specified patterns.
A percent sign (%) replaces any number of characters.
An underscore (_) replaces one character.

where Code like 'E_U%';

Selects observations where the value of Code begins with an E, followed by a single character, followed by a U, followed by any number of characters.

The sounds like (=*) operator selects observations that contain spelling variations of the word or words specified.

where Name=*'SMITH';

Selects names like SMYTHE and SMITT.

IS NULL or IS MISSING selects observations in which the value of the variable is missing.

where Flight is missing;
where Flight is null;

No comments:

Post a Comment