指定したラベルにマクロ処理を分岐させます。
| 種類: | マクロステートメント |
| 別名: | %GO TO |
| 制限事項: | マクロ定義でのみ使用可能 |
| 参照項目: | %labelステートメント |
実行の分岐先にしたいラベル名を指定するか、またはそのようなラベルを生成するテキスト式を指定します。%GOTOステートメント内でラベルを生成するテキスト式のことを、計算される%GOTOの分岐先と呼びます。 (脚注 1)
%goto findit; /* branch to the label FINDIT */
%goto &home; /* branch to the label that is */
/* the value of the macro variable HOME */%macro check(parm);
%local status;
%if &parm= %then %do;
%put ERROR: You must supply a parameter to macro CHECK.;
%goto exit;
%end;
more macro statements that test for error conditions
%if &status > 0 %then %do;
%put ERROR: File is empty.;
%goto exit;
%end;
more macro statements that generate text
%put Check completed successfully.;
%exit: %mend check;