SAS Macro Interview Question and Answers

SAS Macro Interview Question and Answers

SAS Online Training1. What is SAS Macro?

ANS: SAS Macro is a user defined function. It is developed to avoid the calling of that function again and again.

2. What is the purpose of SAS Macro?

ANS: SAS macros stores in auto call library. We can develop Reuseble applications this applications we can use unlimited times. Macro language can be used to save more time and work for programming.

3. How would you invoke a macro?  

ANS: by adding the percent sign prefix to its name like % macro name a semicolon is not required when invoking a macro, though adding one generally does no harm.

4. What is the maximum length of the macro variable?

ANS: 32 characters long.

5. How we can call macros with in data step?

ANS: We can call the macro with CALLSYMPUT

6. What is auto call macro and how to create a auto call macro?

ANS: SAS enables the user to call macros that have been stored as SAS programs. The auto call macro facility allows users to access the same macro code from multiple SAS programs.

7. Automatic variables for macro?

ANS: Every time we invoke SAS, the macro processor automatically creates certain macro var. eg: &sysdate &sysday.

8. How we can call macros with in data step?

ANS: We can call the macro with CALL SYMPUT, Proc SQL, %LET statement and macro parameters.

9. Can we execute macro within another macro? If so, how would SAS know where the current macro ended and the new one began?

ANS: Yes, we can execute macro within a macro, we call it as nesting of macros, which is allowed. Every macro’s beginning is identified the keyword %macro and end with %mend.

10. What do you code to create a macro? End one?

ANS: We create a macro with %MACRO statement and end a macro with %MEND statement.

11. How long can a macro variable be?

ANS: A component of SAS known as the word scanner breaks the program text into fundamental units called tokens. Tokens are passed on demand to the compiler.

12. What is the difference between %LOCAL and %GLOBAL?

ANS: % Local is a macro variable defined inside a macro. %Global is a macro variable defined in open code.

13. How would you identify a macro variable?

ANS: with Ampersand (&) sign

14. If you use a SYMPUT in a DATA step, when and where can you use the macro variable?

ANS: Macro variable is used inside the Call Symput statement and is enclosed in quotes.

15. What do you code to create a macro?

ANS: End one? %MACRO and %MEND.

16. How are parameters passed to a macro?

ANS: A macro variable defined in parentheses in a %MACRO statement is a macro parameter. Macro parameters allow you to pass information into a macro.

17. What is the maximum length of the macro variable?

ANS: 32 characters long.

18. What are Automatic variables for macro?

ANS: Every time we invoke SAS, the macro processor automatically creates certain macro var. eg: &sysdate &sysday.

19. What system options would you use to help debug a macro?

ANS: The SAS System offers users a number of useful system options to help debug macro issues and problems.

20. How do you delete a macro variable?

ANS: If the macro variable is stored in the library then it is a easy to delete it. Multiple variables may be deleted by placing the variable names in the DELETE statement.

For Best SAS Online Training please visit http://www.revanthtechnologies.com