Archive für 15.1.2007

SAS: Using GOTO Statement in Macro Steps

It is not perfect to use the GOTO statement in SAS Code. But if needed you can use the following macro structure:

%macro goto_struct(var);
%IF %QUOTE(&var) NE 16444 %THEN %DO;
%GOTO error; %
%error:
data error;
x=1;
output;
run;
%END;

%IF %QUOTE(&var) EQ 16444 %THEN %DO;
%GOTO ok; %
%ok:
data ok;
x=2;
output;
run;
%END;
%mend goto_struct;
%goto_struct(
100);
 

|