how we can call macros with in data step?

Answers were Sorted based on User's Feedback



how we can call macros with in data step?..

Answer / name is no need

oh....use less felows don't give this much answers how can
a person knows which one is the correct answer,i can see
here more wrong answers than correct answers.i suggest some
of the people who don't know the exact answer better don't
post stupid answers ,why because the persons who are facing
the interview they are in learning stage they can't
differentiate the answers.

Is This Answer Correct ?    19 Yes 0 No

how we can call macros with in data step?..

Answer / syam

using call excute

Is This Answer Correct ?    10 Yes 1 No

how we can call macros with in data step?..

Answer / learner

We have to use call execute to call a macro. For other
answers
1 &(amperson) is used to resolve the macrovariable and not
call macro .
2 Call symput is to define a macro variable dynamical in
data step. useful in data driven programs.

3 symget is to get the macro variable from symbol table and
not call a macro.

Hope it will help..would recomand to double check before
post ..al the best

Is This Answer Correct ?    11 Yes 2 No

how we can call macros with in data step?..

Answer / xyz

oh....use less felows don't give this much answers how can
a person knows which one is the correct answer,i can see
here more wrong answers than correct answers.i suggest some
of the people who don't know the exact answer better don't
post stupid answers ,why because the persons who are facing
the interview they are in learning stage they can't
differentiate the answers.

Is This Answer Correct ?    6 Yes 0 No

how we can call macros with in data step?..

Answer / selvi

We can call macro in a dataset by preceding % with macro
name.

call symput - used to create macro variable in data step.

symget - used to assign value of macro variable to data
step variable.

Is This Answer Correct ?    5 Yes 1 No

how we can call macros with in data step?..

Answer / sr

call execute and also %macro both used

Is This Answer Correct ?    1 Yes 0 No

how we can call macros with in data step?..

Answer / pambrose

here is the answer with self explaining code... picked from SAS book

data prices; /* ID for price category and actual price */
input code amount;
datalines;
56 300
99 10000
24 225
;

data names; /* name of sales department and item sold */
input dept $ item $;
cards;
BB Boat
SK Ski
;
%macro items(codevar=); /* create macro variable if needed */
%global special;
data _null_;
set names;
if &codevar=99 and dept='BB' then
call symput('special', item);
run;
%mend items;

data _null_; /* call the macro in this step */
set prices;
if amount > 500 then
call execute('%items(codevar=' || code || ')' );
run;

data sales; /* use the value created by the macro in this step */
set prices;
length saleitem $ 20;
saleitem="&special";
run;

Is This Answer Correct ?    1 Yes 0 No

how we can call macros with in data step?..

Answer / kumaraswamy maduri

Answer 10 is perfect i.e use Call execute to compile and
execute a macro with in a data step.

Is This Answer Correct ?    0 Yes 0 No

how we can call macros with in data step?..

Answer / net_ameen

Call Execute() is used to call Macro aswellas call macro variable eg: Call execute ('%macroname');
Call execute ('&macrovarname');

Call Symput() is used to create a Global macro variable from within a datastep.

Symget() is used to call a macro variable and assign its value to a datastep variable.

%include() is not a macro statement yet used to call either a macro, extn file containing codes or proc/datastep within a program to be executed together.

Resolve() is used to resolve macro variables created thru call symput within same datastep.

Hope this helps. If any argument pls post.

Is This Answer Correct ?    0 Yes 0 No

how we can call macros with in data step?..

Answer / saslearner

syntax:
data _null_;
call execute("%macroname(perameters)");
run;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SAS Interview Questions

Are you familiar with special input delimiters How are they used?

3 Answers  


What statement do you code to tell SAS that it is to write to an external file?

5 Answers  


I use NOCUM/NOPERCENT option in the tables statement like this Proc freq data = deepak; tables x y /nocum nopercent; run; Here I get nopercent and nocum in the output only for variables x and y. How do i do it for all variables? Deepak

1 Answers  


i have a macro variable var1,var2. i want titles for the each macro variable separately? how it is possible?

1 Answers   L&T,


Are you familiar with special input delimiters? How are they used?

4 Answers   Accenture,






What are some problems you might encounter in processing missing values? In Data steps? Arithmetic? Comparisons? Functions? Classifying data?

1 Answers   Quintiles,


What is LOGICAL VARIABLES in SAS.And how it can be used..Can anyone support..???

3 Answers  


how to extract data from SAP servers? Is like oracle servers or any other methods to extract please reply me.

1 Answers  


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

3 Answers   Quintiles,


What are SAS/ACCESS and SAS/CONNECT?

0 Answers  


Why is a STOP statement needed for the point=option on a SET statement?

2 Answers   Quintiles,


Which is the best training institute for SAS in Delhi. Please reply

12 Answers   HCL, HSBC,


Categories