how we can call macros with in data step?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
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 |
Answer / net_ameen
Call Execute() is used to call Macro aswellas call macro variable eg: Call execute ('%macroname');
Call execute ('¯ovarname');
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 |
Answer / saslearner
syntax:
data _null_;
call execute("%macroname(perameters)");
run;
| Is This Answer Correct ? | 0 Yes | 0 No |
how many types of MERGE?
what is the diff b/w verification validation in sas
Have you ever used the SAS Debugger?
hi i date is 05sep2005; i want the oupput like 05sep2005:00:00:00 ; how it wil come?
here is a string like chq.2312244%4452- from that i want only special characters in a column. dont use compress. bcoz i have 1.2 billion of records.i want another process to find the values instant from the data.
In this question, I rename the numeric variable phone to numphone and then try use phone=put(numphone,comma16.) to store the numeric value numphone as a string value in phone. But I get a warning tha numphone already exists and in the data sat phone doesnt exist and numphone is set to missing. Why? data names_and_more; input Name $20. Phone : comma16. Height & $10. Mixed & $8.; Name = tranwrd(Name,' ',' '); rename phone = numphone; phone = put(numphone,comma16.); datalines; Roger Cody 9,087,821,234 5ft. 10in. 50 1/8 Thomas Jefferson 3,158,488,484 6ft. 1in. 23 1/2 Marco Polo 8,001,234,567 5Ft. 6in. 40 Brian Watson 5,183,551,766 5ft. 10in 89 3/4 Michael DeMarco 4,452,322,233 6ft. 76 1/3 ;
I have 3 years of work experience at a startup and recently got certified in Data Science with SAS. I need to know how to get into the analytics industry
What does PROC print, and PROC contents do?
What type of tables you are using in YOUR reporting..???
2 Answers GSK GlaxoSmithKline,
How we can create SAS USER DEFINED CODE?
i have a dataset with 100000 records. i want 100 records from that dataset and create a dataset.we need to pick the observations random order like 100obs,500obs,1020obs,1890obs,2565obs like that i need 100 obs in random order? how can we create this one?
What are the best sas programming practices for handling very large datasets? : sas-grid-administration