0% found this document useful (0 votes)
26 views5 pages

Advanced Programmingsas 94

The document provides sample questions for the SAS 9.4 Advanced Programming Performance-Based Exam, including performance-based programming tasks and standard questions. Each question outlines specific programming requirements and expected outputs, along with correct solutions for reference. The document also includes questions related to SQL queries, data merging, and efficiency improvements in data storage.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views5 pages

Advanced Programmingsas 94

The document provides sample questions for the SAS 9.4 Advanced Programming Performance-Based Exam, including performance-based programming tasks and standard questions. Each question outlines specific programming requirements and expected outputs, along with correct solutions for reference. The document also includes questions related to SQL queries, data merging, and efficiency improvements in data storage.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Sample Questions

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.

SAS 9.4 Advanced Programming Performance-Based Exam


Performance-Based Programming Questions
Note: The programming projects are assessed with a scoring macro that is stored on the lab computer. At
the end of your project, you will invoke the scoring macro and it will investigate the results of your project. It will
look at parameters and content of output data set as well as values of macro variables stored in the symbol tables.
This macro will also investigate the code that you wrote to check that the problem was solved as requested. These
are broad checks, so there is still a significant amount of freedom in your chosen coding solution. For example, in
the SQL topic, we want to ensure that an SQL procedure was used to create the output data set rather than a DATA
Step. The scoring macro will return a 3-digit value to the SAS log. You will record this 3-digit value as your answer
to the project to determine your score for the project.

Question 1
Open a new programming window to create ACT01.sas in c:\cert\programs.

Write a SAS program that will:


• Create output data set work.ACT01 using sashelp.pricedata as input.
• Use an array to increase the values of the price1 through price17 variables by 10%.

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.

Write an SQL query that will:


• Create output data set work.SQL01 using sashelp.cars as input.
• Compute the average MPG_City for each group of Make. Name the calculated variable
AvgCityMPG.
• The output data should have 2 columns, Make and AvgCityMPG.
Run your program and troubleshoot as necessary. When you are finished with the project:
1. Ensure that you have saved your program as SQL01.sas in c:\cert\programs.
2. From the score.sas program, call the scoreit macro using SQL01 as the
parameter: %scoreit(SQL01).
What is the value for Response in the SAS log? __

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?

A. proc sql; create table three as


select *
from one full join two
where one.num = two.num; quit;
B. proc sql; create table three as
select coalesce(one.num, two.num)
as NUM, char1, char2 from
one full join two where
one.num = two.num; quit;

C. proc sql; create table three as


select one.num, char1, char2
from one full join two on
one.num = two.num; quit;

D. proc sql; create table three as


select coalesce(one.num, two.num)
as NUM, char1, char2 from
one full join two on
one.num = two.num; quit;

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?

A. proc print data =


sasdata.sales; by date;
run;

B. proc print data =


sasdata.sales; where
month(date) = 3; run;

C. data march; set


sasdata.sales;
if '01mar2002'd < date < '31mar2002'd;
run;

D. data march; set


sasdata.sales;
where date < '31mar2002'd or revenue > 50000;
run;

correct_answer = "A"

Question 6
Given the following SQL procedure output:
Table Physical Obs % Deleted

EMPLOYEE_ADDRESSES 424 5.0%


EMPLOYEE_PAYROLL 424 5.0%
Which SQL query will produce a report for tables in the ORION library which have had at least 5% of
their physical rows deleted, as shown above?

A. select MEMNAME 'Table', NOBS 'Physical Obs' ,


DELOBS/NOBS '% Deleted' format=percent6.1
from dictionary.tables
where LIBNAME='ORION' AND DELOBS/NOBS >= .05;

B. select Table_Name, Num_Rows 'Physical Obs'


, Deleted_Rows/Num_Rows '% Deleted'
format=percent6.1 from dictionary.DBA_TABLES where
TABLESPACE_NAME='ORION' AND Deleted_Rows/Num_Rows
>= .05;

C. select MEMNAME 'Table', NLOBS 'Physical Obs'


, DELOBS/NLOBS LABEL='% Deleted' format=percent6.1
from dictionary.tables
where LIBNAME='ORION' AND DELOBS/NLOBS >= .05;

D. select MEMNAME 'Table', NOBS 'Physical Obs'


, DELOBS/NOBS LABEL='% Deleted' format=percent6.1
from dictionary.members
where LIBNAME='ORION' AND DELOBS/NOBS >= .05;

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"

You might also like