statquant
statquant

Reputation: 14360

How can I continue to next iteration in data step in SAS

I have a data step say :

data Tbl2;
    set Tbl;
    if something then do ;
       somethingelse;
       #HERE I WANT TO SKIP REST OF CODE AND GET NEXT ITERATION#
    end;
    some stuff that get usually executed unless something occur;
run;

When I use continue SAS tells me that it can only be used in a do/end block with iterations. How can I achieve this trivial thing ?

Upvotes: 2

Views: 3826

Answers (1)

vasja
vasja

Reputation: 4792

RETURN statement does the magic.

Example from SAS help:

data survey;
   input x y;
   if x=y then return;
   put x= y=;
   datalines;
21 25
20 20
7 17
;
run;


x=21 y=25
x=7 y=17

In DO loops, LEAVE and CONTINUE statements can be used.

Upvotes: 1

Related Questions