Advanced Programmingsas 94
Advanced Programmingsas 94
The following sample questions are not inclusive and do not necessarily represent all of the types of questions that
comprise the exams. The questions are not designed to assess an individual's readiness to take a certification exam.
Question 1
Open a new programming window to create ACT01.sas in c:\cert\programs.
Run your program and troubleshoot as necessary. When you are finished with the project:
1. Ensure that you have saved your program as ACT01.sas in c:\cert\programs.
2. From the score.sas program, call the scoreit macro using ACT01 as the
parameter: %scoreit(ACT01).
What is the value for Response in the SAS log? ___
Correct Solution: All price values for all price1-through price17 will be increased by 10%. For
example, price2 in observation 5 will now be 126.50. Arrays and do loops would be used in the
program.
Question 2
Open a new programming window to create MAC01.sas in c:\cert\programs.
Write a DATA step that reads only the first observation of the sashelp.cars data set and stores the value
of the Make variable in a macro variable named CarMaker.
The macro variable must be defined from within the DATA Step.
Run your program and troubleshoot as necessary. When you are finished with the project:
1. Ensure that you have saved your program as MAC01.sas in c:\cert\programs.
2. From the score.sas program, call the scoreit macro using MAC01 as the
parameter: %scoreit(MAC01).
What is the value for Response in the SAS log? __
Correct Solution: The CarMaker macro variable will have a value of Acura. The program will include
a symputx routine.
Question 3
Open a new programming window to create SQL01.sas in c:\cert\programs.
Correct Solution: An SQL query with a group by clause will be written. The AvgCityMPG for
MAKE=MINI will be 26.5.
Standard Questions
Question 4
Given the following SAS data sets ONE and TWO:
The following SAS program is submitted creating the output table THREE:
data three;
merge one (in = in1) two (in =
in2); by num; run;
Which one of the following SQL programs creates an equivalent SAS data set THREE?
correct_answer = "D"
Question 5
The SAS data set SASDATA.SALES has a simple index on the variable DATE and a variable named
REVENUE with no index.
In which one of the following SAS programs is the DATE index considered for use?
correct_answer = "A"
Question 6
Given the following SQL procedure output:
Table Physical Obs % Deleted
correct_answer = "A"
Question 7
The following SAS program is submitted:
options ;
%abc(work.look,Hello,There);
In the text box above, complete the options statement that will produce the following log messages:
M*****(ABC): title1 "Hello" ;
M*****(ABC): title2 "There" ;
M*****(ABC): proc print data=work.look ;
M*****(ABC): run ;
correct_answer = "mprint"
Question 8
The following SAS program is submitted:
%macro mysum(n);
%if &n > 1 %then %eval(&n + %mysum(%eval(&n-1)));
%else &n;
%mend;
%put %mysum(4);
Which output is written to the log?
A. 10
B. 4+3+2+1
C. 7
D. A character operand was found in the %EVAL function or %IF
condition where a numeric operand is required.
correct_answer = "A"
Question 9
A local permanent data set has the following characteristics:
• 80 character variables, length 200, storing 28 bytes of non-repeating characters
• 120 numeric variables, length 8, 14 digits
• 4000 observations
What is the best way to reduce the storage size of this data set?
A. Compress the data set with character compression
B. Reduce length of character variables to 28 bytes
C. Compress the data set with binary compression
D. Reduce length of character variables to 6 bytes correct_answer = "B"