Answer Posted / nani
%macro add(a,b);
%if (%datatyp(&a)=NUMERIC and %datatyp(&b)=NUMERIC) %then %
do;
%put The result is %sysevalf(&a+&b).;
%end;
%else %do;
%put Error: Addition requires numbers.;
%end;
%mend add;
You can invoke the ADD macro as:
%add(5.1E2,225)
Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Can you execute a macro within a macro? Describe. : sas-macro
I have a dataset concat having variable a b & c. How to rename a b to e & f?
Explain data_null_?
where to use sas business intelligence? : Sas-bi
what does the run statement do? : Sas programming
Explain the difference between using drop = data set option in set and data statement?
what is data governance? : Sas-di
Tell e how how dealt with..
if a variable contain dates like "2015/01"---"2015/12" (yymm) ,How to add day to those dates,if them month is jan then 31 if the month is feb then 28 so on ...
Name some categories in sas 9? : sas-grid-administration
How to convert a numeric variable to a character variable?
how do you debug and test your sas programs? : Sas programming
If you use a symput in a data step, when and where can you use the macro variable? : sas-macro
Explain the main difference between the sas procedures and functions? : Sas-administrator
What are pdv and it functions?