How do you add a number to a macro variable?
Answers were Sorted based on User's Feedback
Answer / saurabh gupta
To add a number in macro use %EVAL macro
Example
%Let a= 2;
%Let b= 3;
%Let c= &a + &b ;
then it will give you value
c=2 + 3
but If you will use %eval it will give you sum
%Let c= %eval(&a + &b)
Now this will give you the correct answer
c=5
Is This Answer Correct ? | 15 Yes | 0 No |
Answer / 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 |
what are the softwares and applications that are used most frequently used by sas bi applications developers? : Sas-bi
Does SAS ?Translate? (compile) or does it ?Interpret?? Explain.
what is the effect of the options statement errors=1? : Sas programming
how do you want missing values handled? : Sas programming
Mention the difference between ceil and floor functions in sas?
How to specify variables to be processed by the freq procedure?
what is prime numbers? how we can get plc write sas code?
Do you need to rearrange the order of the data for the report?
1.How to draw pivot tables in Excel by using SAS and in which version we can use VB script for to draw pivot tables in Excel? Answer with example data. 2.What are the advantages of _NULL_ in Data steps? Can we use _NULL_ in Proc steps also? 3. How to call the macro variable into Data Steps? 4. Can we draw pivot tables in Excel using Proc SQL? Please post answers for the above questions with suitable examples, and how to use VB script for Excel using SAS.
Explain bmdp procedure?
Tell e how how dealt with..
what is picture format? give any one example?