Type: | Macro statement |
Restriction: | Allowed in macro definitions only |
See: | %END Statement |
%macro untag(title); %let stbk=%str(<); %let etbk=%str(>); /* Do loop while tags exist */ %do %while (%index(&title,&stbk)>0) ; %let pretag=; %let posttag=; %let pos_et=%index(&title,&etbk); %let len_ti=%length(&title); /* Is < first character? */ %if (%qsubstr(&title,1,1)=&stbk) %then %do; %if (&pos_et ne &len_ti) %then %let posttag=%qsubstr(&title,&pos_et+1); %end; %else %do; %let pretag=%qsubstr(&title,1,(%index(&title,&stbk)-1)); /* More characters beyond end of tag (>) ? */ %if (&pos_et ne &len_ti) %then %let posttag=%qsubstr(&title,&pos_et+1); %end; /* Build title with text before and after tag */ %let title=&pretag&posttag; %end; title "&title"; %mend untag;