SIMULATION
Scenario:
This project will use data set cert.input08a and cert.input08b. At
any time, you may save your program
as program08 in cert\programs.
Both data sets contain a common numeric variable named ID.
Write a program that will use a SAS DATA Step to:
o Combine data sets cert.input08a and cert.input08b by
matching values of the ID variable.
o Write only observations that are in both data sets to a
new data set named results.match08.
o Write all other non-matching observations from either
data set to a new data set named results.nomatch08.
o Exclude all variables that begin with
"ex" from results.nomatch08.
How many variables (columns) are in _______________ results.nomatch08
Enter your numeric answer in the space below:
Save your program as ______________ program08.sas in folder cert programs
before continuing with the next project.
Answer : A
SAS code that could be used to solve this project:
Proc
sort data=cert.input08a out=work.input08a;
by ID;
run;
proc sort data=cert.input08b out=work.input08b;
by ID;
run;
data results.match08 results.nomatch08 (drop=ex: );
merge work.input08a (in=a) work.input08b (in=b);
by ID;
if a and b then output results.match08;
else output results.nomatch08;
run;
proc contents data=results.match08;
run;
proc contents data=results.nomatch08;
run;
The correct answer is: 5
SIMULATION
Scenario:
This project will use data set cert.input13. At any time, you may
save your program as program13 in cert\programs.
This data set contains 1001 observations and 2 variables:
o Date1, a numeric variable representing an unformatted
SAS date value. Example: 12001.
o Charnum, a character variable representing a monetary
amount. Example: $50,000.
Write a SAS program that will:
o Save the new data set as results.output13.
o Create a new variable Chdate that converts
the datel variable to a character variable that is in the
format ddmonyyyy, such as 11NOV1992.
o Create a new variable num1 that converts
the Charnum variable to a numeric variable.
What is the average (mean) of the num1 variable for the entire data set?
Enter your numeric answer in the space below (Round your answer to the nearest
integer).
Answer : A
data results.output13;
set cert.input13;
Chdate=put(date 1,date9.);
num 1=input(Charnum,dollar7.);
run;
proc means data=results.output13;
var num 1;
run;
SIMULATION
Scenario:
Continuing with the previous program (program27), add a PROC SORT step that satisfies the following criteria:
o Creates the output dataset results.output27b
o Sorts the observations by order.
o Removes duplicate values of the first occurrence found during the sort.
What is the value of Employee_ID for observation 98 inresults.output27b?
Answer : A
proc sort data=cert.input27 out=results.output27b nodupkey;
by descending postal_code;
run;
proc print data=results.output27b (firstobs=98 obs=181);
var employee_ID;
run:
SIMULATION
Scenario:
This project will use data set cert.input12. At any time, you may
save your program as program12 in cert\programs.
cert.input12 contains a single observation with two variables:
o salary
o year
Write a SAS program that will:
o Create an output data set results.output12.
o Read cert.input12 as input.
o Increase the salary variable by 5.65% annually until it is
greater than $500,000.
o Increment the year variable by 1 with each annual
increase.
o Create an output data set results.output12 that has one
observation for each value of year. Each observation
should have a year and salary variable.
What is the maximum salary hat is less than $500,000? Enter your numeric answer in the space below (Round your answer to the nearest integer)
Answer : A
data results.output12;
set cert.input12;
do until (salary gt 500000);
salary=salary*1.0565;
year+1;
output;
end;
run;
proc print data=results.output 12;
run;
Assume that Sasuser.One does not exist and that the following SAS program is submitted at the beginning of a new SAS session:
data sasuser.one;
x=1;
y=27;
output one; run;
Select one:
Answer : B
Given the following SAS data set WORK.CLASS:
Name Gender Age
Anna F 23
Ben M 25
Bob M 21
Brian M 27
Edward M 26
Emma F 32
Joe M 34
Sam F 32
Tom M 24
The following program is submitted: data WORK.MALES WORK.FEMALES(drop=age); set WORK.CLASS; drop gender; if Gender="M" then output WORK.MALES; else if Gender="F" then output WORK.FEMALES; run; How many variables are in the data set WORK.MALES?
Select one:
Answer : C
The following SAS program is submitted:

What are the values for x and y in the output data set?
Select one:
Answer : D