%do %while (expression);
text and macro program statements;
%end;
These examples illustrate expressions for the %DO %WHILE statement:
Syntax:%eval (arithmetic or logical expression)
evaluates integer arithmetic (add, minus, multiple and fraction)or logical expressions.
examples:
%let d=%eval(10+20); /* Correct usage */
example for %do %while %end and %eval
%macro see(str=) ;
%local i ;
%let i = 1 ;
%do %while ( %scan(&str.,&i.) ne ) ;
%put %scan(&str.,&i.) ; %let i = %eval ( &i + 1 ) ;
%end ;
%mend see ;%end ;
%see ( str = aa bb cc )
data need;
do i=1 by 1 while (scan("a b c",i,"") ne "");
x=scan("a b c",i,"");
output;
end;
run;
data step and macro see do the same job.
No comments:
Post a Comment