INTERVIEW QUESTIONS
1. Name some of the ways to create a macro variable
Ans: CALL SYMPUT, %LET statement and macro parameters.
2. How to create macro in auto-call library?
Ans: OPTIONS MSTORED SASMSTORE= library;
3. What is difference between proc means and proc summary?
Ans:
Proc means by default give you the output in the output window and you can stop
this by the option NOPRINT and can take the output in the separate file by the
statement OUTPUT OUT= , But, proc summary doesn't give the default output, we
have to explicitly give the output statement and then print the data by giving PRINT
option to see the result.
4. What is the use of Nowd option in Proc report?
Ans: if we run the report procedure we will get results in report window, if we use
nowd option we will get results in output window.
5. How can you create a macro variable with in data step?
Ans: with CALL SYMPUT
6. How do you identify a macro variable?
Ans: with Ampersand (&) sign
7. Write Proc SQL syntax?
Ans:
proc sql;
<Statements>
Quit;
8. How do you merge data in Proc SQL?
Ans: using Joins
9. What system options would you use to help debug a macro?
Ans: OPTIONS MPRINT MLOGIC MERROR SYMBOLGEN;
10. How would you determine the number of missing or non missing values in proc sql?
Ans: count,n, freq for number of non missing values
Nmiss for number of missing values
11. What is the difference between calculating the 'mean' using the mean function and
PROC MEANS?
Ans: By default Proc Means calculate the summary statistics like N, Mean, Std
deviation, Minimum and maximum, Where as Mean function compute only the
mean values.
12. What techniques and/or PROCs do you use for tables?
Ans:proc freq, proc report, proc tabulate
13. Code the table’s statement for a one level frequency?
Ans:
proc freq data=dsn;
table var1;
run;
14. How Can you delete or update a table in external database?
Ans: using PTF(pass through facility)
15. How would you invoke (recall) a macro?
Ans: by adding a percent sign in front of the macro-name
%macro-name
16. How would you find sum in proc SQL?
Ans: using sum function
17. How are parameters passed to a macro? Write the code?
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.
Positional parameters
%macro macroname(mpar1,mpar2);
<Code>
%mend;
% macroname(mpar1value,mpar2value)
Keyword parameters
%macro macroname(mpar1=,mpar2=);
<Code>
%mend;
% macroname(mpar1=mpar1value, mpar2=mpar2value)
18. How would you define the end of a macro?
Ans: %Mend Statement
19. Code the table statement to produce a multi-level(cross)frequency?
Ans:
proc freq data=dsn;
table var1*var2;
run;
20. Write the option to produce a frequency line items rather that a table?
Ans: list option
21. Code the MEANS to produce output to be used later?
Ans: output out statement and noprint option in proc mans statement
22. PROC REPORT or PROC TABULATE? Which do you prefer? Explain.
Ans: I prefer to use Proc report until I have to create cross tabulation tables,
because, It gives me so many options to modify the look up of my table
23. What is the difference between LOCAL and GLOBAL Macro variables?
Ans: Local macro variable defined inside a macro. Global macro variable defined in
open code (outside the macro or can use anywhere).
24. Model statement syntax?
Ans: model dependent varaibale=independent varaibale
25. Write the code to sort the data in proc sql ?
Ans: using order by in select statement
26. Write the option to label the statistical keyword in tabulate procedure?
Ans: keylabel option
27. How would you produce the output in other formats? Write the code?
Ans: using ods
Ods format file=’external source’
<Statements>
Ods format close;
28. How would you store sas gcharts & gplots in specified library/catalogs?
Ans: using gout option in gchart and gplot statements
gout=libref.catalog
29. Use of computed keyword in proc report?
Ans: Defines the specified item as a computed variable. Computed variables are
variables that you define for the report. They are not in the input data set, you can
add a computed variable by including the computed variable in the COLUMN
statement and defining the variable's usage as COMPUTED in the DEFINE
statement
30. Which procedure would you prefer to use for analysis of variance if the data is
unbalanced.
Ans: proc glm