IF Col_A contains ("N") and Col_B contains ("M") THEN DELETE??

  • Follow


IT seems contains statement can only follow where operator,
But I want to do more operation if the row meet the requirement.
How to fulfill my needs?

0
Reply litonchen (27) 11/17/2011 12:10:07 PM

On Nov 17, 7:10=A0am, "litonc...@gmail.com" <litonc...@gmail.com> wrote:
> IT seems contains statement can only follow where operator,
> But I want to do more operation if the row meet the requirement.
> How to fulfill my needs?

I believe you are correct that CONTAINS can only be place in a WHERE
statement. You can place a WHERE statement in a dataset, similar to an
IF statement.

data abc;
    set whatever;
    where not (col_A contains "N" and col_B contains "M");
    ... more statements ...
run;

--
Paige Miller
paige\dot\miller \at\ kodak\dot\com
0
Reply paige.miller (581) 11/17/2011 2:01:32 PM


On Nov 17, 6:01=A0am, Paige Miller <paige.mil...@kodak.com> wrote:
> On Nov 17, 7:10=A0am, "litonc...@gmail.com" <litonc...@gmail.com> wrote:
>
> > IT seems contains statement can only follow where operator,
> > But I want to do more operation if the row meet the requirement.
> > How to fulfill my needs?
>
> I believe you are correct that CONTAINS can only be place in a WHERE
> statement. You can place a WHERE statement in a dataset, similar to an
> IF statement.
>
> data abc;
> =A0 =A0 set whatever;
> =A0 =A0 where not (col_A contains "N" and col_B contains "M");
> =A0 =A0 ... more statements ...
> run;
>
> --
> Paige Miller
> paige\dot\miller \at\ kodak\dot\com

or change to index instead:

if index(col_a,'N') and index(col_b,'M') then delete;
0
Reply huang8012 (261) 11/17/2011 2:32:19 PM

2 Replies
21 Views

(page loaded in 0.174 seconds)


Reply: