Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How do you add a number to a macro variable?

Answers were Sorted based on User's Feedback



How do you add a number to a macro variable?..

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

How do you add a number to a macro variable?..

Answer / kavitha

USING %EVAL FUNCTION
%let i=%eval(&i+1);

Is This Answer Correct ?    3 Yes 1 No

How do you add a number to a macro variable?..

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

Post New Answer

More SAS Interview Questions

what is sas data set?

0 Answers  


What is the order of evaluation of the comparison operators: + - * /** ()?

3 Answers   Quintiles,


please can you tell me that in companies sas work are doing by through sas coding or sas wizard ??

0 Answers  


Differentiate input and infile.

0 Answers  


Can Some one Explain How the Datasets from SAS can be loaded in to the MVS OS?

1 Answers   HCL,


What will calendar procedure do?

0 Answers  


Does anybody has lastest SAS certification dumps,if anybody has please mail me at akshara_SAS@ymail.com Thanks Akshara

55 Answers  


How to create an external dataset with sas code?

0 Answers  


In proc transpose and data step with arrays which one you pick?

0 Answers   Accenture, Quintiles,


Can you execute macro within another macro? : sas-macro

0 Answers  


How do you control the number of observations and/or variables read or written? Approximately what date is represented by the SAS date value of 730?

0 Answers   Quintiles,


what are the new features included in the new version of SAS i.e., SAS9.1.3?

5 Answers   College School Exams Tests, Wockhardt,


Categories