Top 100+ Sas Macro Interview Questions And Answers
Question 1. Have You Used Macros? For What Purpose You Have Used?
Answer :
Yes I actually have, I used macros in creating evaluation datasets and tables where it's miles important to make a small change through out the program and wherein it is important to use the code time and again.
Question 2. How Would You Invoke A Macro?
Answer :
After I have described a macro I can invoke it by way of including the percentage sign prefix to its call like this: % macro name a semicolon isn't required when invoking a macro, although including one normally does no damage.
SAS Programming Interview Questions
Question three. How Can You Create A Macro Variable With In Data Step?
Answer :
With CALL SYMPUT.
Question four. How Would You Identify A Macro Variable?
Answer :
With Ampersand (&) sign.
SAS Programming Tutorial
Question five. How Would You Define The End Of A Macro?
Answer :
The end of the macro is described by using %Mend Statement.
Logistics Interview Questions
Question 6. For What Purposes Have You Used Sas Macros?
Answer :
If we need use a application step for executing to execute the same Proc step on multiple facts units. We can accomplish repetitive responsibilities fast and correctly. A macro program can be reused typically. Parameters exceeded to the macro application customize the results while not having to alternate the code within the macro application. Macros in SAS make a small exchange within the software and have SAS echo that trade thought that application.
Question 7. What Is The Difference Between %nearby And %global?
Answer :
% Local is a macro variable defined inside a macro.%Global is a macro variable defined in open code (outdoor the macro or can use everywhere).
SASS (Syntactically Awesome Style sheets) Tutorial SAS Programming,SQL server Interview Questions
Question eight. How Long Can A Macro Variable Be? A Token?
Answer :
A thing of SAS called the phrase scanner breaks this system text into essential devices known as tokens.
Tokens are handed on call for to the compiler.
The compiler then requests token until it receives a semicolon.
Then the compiler plays the syntax take a look at on the statement.
Question nine. If You Use A Symput In A Data Step, When And Where Can You Use The Macro Variable?
Answer :
The macro variable created by means of the CALL SYMPUT routine cannot be used in the same datastep in which it were given created. Other than that we are able to use the macro variable at any time.
SASS (Syntactically Awesome Style sheets) Interview Questions
Question 10. What Do You Code To Create A Macro?
Answer :
We create a macro with %MACRO assertion and give up a macro with %MEND statemnt.
R Programming language Tutorial
Question eleven. What Is The Difference Between %positioned And Symbolgen?
Answer :
%PUT is used to display person described messages on log window after execution of a program wherein as % SYMBOLGEN is used to print the fee of a macro variable resolved, in log window.
SQL Server Analysis Services (SSAS) Interview Questions
Question 12. How Do You Add A Number To A Macro Variable?
Answer :
Using %eval characteristic or %sysevalf characteristic if the number is a floating variety.
SAS Programming Interview Questions
Question thirteen. Can You Execute A Macro Within A Macro? Describe.
Answer :
Yes, Such macros are called nested macros. They may be acquired by means of using symget and call symput macros.
Question 14. If You Need The Value Of A Variable Rather Than The Variable Itself What Would You Use To Load The Value To A Macro Variable?
Answer :
If we want a fee of a macro variable then we ought to define it in such terms so that we will name them everywhere in the software. Define it as Global. There are specific ways of assigning a worldwide variable. Simplest technique is %LET.
Ex:
A, is macro variable. Use following statement to assign the value of a in preference to the variable itself
%Let A=xyz; %placed x="&A";
This will assign "xyz" to x, no longer the variable xyz to x.
Question 15. Can You Execute Macro Within Another Macro? If So, How Would Sas Know Where The Current Macro Ended And The New One Began?
Answer :
Yes, I can execute macro within a macro, we call it as nesting of macros, that's allowed, Every macro's starting is diagnosed the key-word %macro and give up with %mend.
R Programming language Interview Questions
Question 16. How Would You Code A Macro Statement To Produce Information On The Sas Log? This Statement Can Be Coded Anywhere?
Answer :
OPTIONS MPRINT MLOGIC MERROR SYMBOLGEN.
Question 17. How We Can Call Macros With In Data Step?
Answer :
We can call the macro with
CALL SYMPUT,
Proc SQL ,
%LET declaration. And macro parameters.
SAS DI Interview Questions
Question 18. Tell Me About % Include And % Eval?
Answer :
The %consist of announcement, regardless of its percentage sign, isn't a macro announcement and is continually performed in SAS, though it may be conditionally achieved in a macro.It may be used to putting in a macro library. But this is a least technique.
The use of %consist of does not truely set up a library. The %consist of announcement factors to a document and whilst it accomplished the indicated report (be it a complete application, macro definition, or a announcement fragment) is inserted into the calling program at the vicinity of the decision.
When the use of the %encompass building a macro library, the blanketed document will generally contain one or more macro definitions.%EVAL is a broadly used yet frequently misunderstood SAS(r) macro language characteristic because of its apparently simple form.
However, when its actual argument is a complex macro expression interlaced with special characters, combined arithmetic and logical operators, or macro quotation functions, its usage and end result become elusive and complex. %IF circumstance in macro is evaluated with the aid of %eval, to reduce it to authentic or false.
Logistics Interview Questions
Question 19. Describe The Ways In Which You Can Create Macro Variables?
Answer :
There are the 5 ways to create macro variables:
%Let
%Global
Call Symput
Proc SQl into clause
Macro Parameters.
Question 20. Tell Me More About The Parameters In Macro?
Answer :
Parameters are macro variables whose cost you put while you invoke a macro. To upload the parameters to a macro, you without a doubt name the macro vars names in parenthesis within the %macro assertion.
Syntax:
%MACRO macro-name (parameter-1= , parameter-2= , ……parameter-n = );
macro-textual content%;
%MEND macro-call;
%macro_name(par1,par2,....Parn);
Advanced SAS Interview Questions
Question 21. What Is The Maximum Length Of The Macro Variable?
Answer :
32 characters lengthy.
Question 22. Automatic Variables For Macro?
Answer :
Every time we invoke SAS, the macro processor automatically creates positive macro var.
Eg: &sysdate &sysday.
Question 23. What System Options Would You Use To Help Debug A Macro?
Answer :
The SAS System offers customers some of beneficial machine alternatives to assist debug macro problems and issues. The consequences associated with the usage of macro alternatives are routinely displayed on the SAS Log.
Specific options associated with macro debugging seem in alphabetical order within the desk under:
MEMRPT: Specifies that memory utilization facts be displayed on the SAS Log.
MERROR: SAS will difficulty caution if we invoke a macro that SAS didn’t discover. Presents Warning Messages whilst there are misspellings or when an undefined macro is referred to as.
SERROR: SAS will trouble warning if we use a macro variable that SAS can’t discover.
MLOGIC: SAS prints information about the execution of the macros in the log.
MPRINT: Displays SAS statements generated by means of macro execution are traced at the SAS Log for debugging functions.
SYMBOLGEN: SAS prints the value of macro variables in log and additionally presentations text from increasing macro variables to the SAS Log.
Base Sas Interview Questions
Question 24. What Are Symget And Symput?
Answer :
SYMPUT places the value from a dataset right into a macro variable wherein as SYMGET gets the fee from the macro variable to the dataset.
SAS Programming,SQL server Interview Questions
Question 25. What Is Auto Call Macro And How To Create A Auto Call Macro? What Is The Use Of It? How To Use It In Sas With Macros?
Answer :
SAS Enables the consumer to call macros which have been saved as SAS packages.
The auto name macro facility allows users to get entry to the equal macro code from multiple SAS programs. Rather than having the equal macro code for in each application in which the code is required, with an autocall macro, the code is in a single place. This permits faster updates and higher consistency throughout all of the programs.Macro set-up:The fist step is to set-up a software that consists of a macro, preferred to be used in a couple of applications. Although this system can also incorporate other macros and/or open code, it's far recommended to encompass simplest one macro.
Set MAUTOSOURSE and SASAUTOS:
Before you can use the autocall macro inside a SAS program, The MAUTOSOURSE option must be set open and the SASAUTOS choice have to be assigned. The MAUTOSOURSE option indicates to SAS that the autocall facility is to be activated. The SASAUTOS option tells SAS wherein to search for the macros.
For ex: sasauto=’g:busmeasinternalmacro’.
 
   
    
 
  
  
  
  
  
 