式に固有の最初の文字の位置を返します。
種類: | 自動呼び出しマクロ |
要件 | MAUTOSOURCEシステムオプション |
%macro isname(name); %let name=%upcase(&name); %if %length(&name)>8 %then %put &name: The fileref must be 8 characters or less.; %else %do; %let first=ABCDEFGHIJKLMNOPQRSTUVWXYZ_; %let all=&first.1234567890; %let chk_1st=%verify(%substr(&name,1,1),&first); %let chk_rest=%verify(&name,&all); %if &chk_rest>0 %then %put &name: The fileref cannot contain "%substr(&name,&chk_rest,1)".; %if &chk_1st>0 %then %put &name: The first character cannot be "%substr(&name,1,1)".; %if (&chk_1st or &chk_rest)=0 %then %put &name is a valid fileref.; %end; %mend isname; %isname(file1) %isname(1file) %isname(filename1) %isname(file$)
FILE1 is a valid fileref.1FILE:The first character cannot be "1".FILENAME1:The fileref must be 8 characters or less.FILE$:The fileref cannot contain "$".