SIMULATION
Scenario:
This project will use data set cert.input27. At any time, you may
save your program as program27 in cert\programs. You will use
this program in the next project.
Write a SAS program that will:
o Create output data set results.output27a as a subset
of cert.input27 where the country variable's value is
"US" (any variation of case, such as US or us).
o Sort results.output27a:
" first by the variable state in ascending order
" then by Postal_Code in descending order
" and finally by employee_ID in ascending order.
Run the program and use the results to answer the question below.
What is the value of Employee_ID for observation 100 in results.output27a?
120781
Explanation:
proc sort data=cert.input27
out=results.output27a(where=(upcase (country)='US'));
by state descending Postal_Code employee_ID;
run;
proc print data=results.output27a (firstobs=100 obs=100);
var employee_ID;
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?
120779
Explanation:
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:
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 181 inresults.output27b?
120272
Explanation:
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 setcert.input36. At any time, you may save your program asprogram36 in
cert\programs. Write a SAS program that will clean the data incert.input36as follows:
Step 1:
create a temporary data set, cleandata36.
In this data set, convert all case.
Then keep only observations with group equal to 'A' or 'B'.
Step 2:
Determine the MEDIAN value for the Kilograms variable for each group(A,B) in the cleandata36
data set. Round MEDIAN to the nearest whole number.
Step 3:
Create results.output36 from cleandata36
Ensure that all values for variable Kilogramsare between 40 and 200, inclusively.
If the value is missing or out of range, replace the value with the MEDIAN Kilograms value for the
respectivegroup(A,B) calculated in step 2
How many observations are inresults.output36?
4992
Explanation:
data work.cleandata36;
set cert.input36;
group=upcase(group);
if group in ('A','B');
run;
proc means data=work.cleandata36 median;
class group;
var kilograms;
run;
data results.output36;
set cleandata36;
if Kilograms < 40 or Kilograms > 200 then do;
if group='A' then kilograms=79; else kilograms=89;
end;
run;
proc contents data=results.output36;
run;
SIMULATION
Scenario:
This project will use data setcert.input36. At any time, you may save your program asprogram36 in
cert\programs. Write a SAS program that will clean the data incert.input36as follows:
Step 1:
create a temporary data set, cleandata36.
In this data set, convert all case.
Then keep only observations with group equal to 'A' or 'B'.
Step 2:
Determine the MEDIAN value for the Kilograms variable for each group(A,B) in the cleandata36
data set. Round MEDIAN to the nearest whole number.
Step 3:
Create results.output36 from cleandata36
Ensure that all values for variable Kilogramsare between 40 and 200, inclusively.
If the value is missing or out of range, replace the value with the MEDIAN Kilograms value for the
respectivegroup(A,B) calculated in step 2
What is the MEAN Kilograms value for group='A' in the results.output36 data set?
76.3
Explanation:
SIMULATION
Scenario:
This project will use data setcert.input36. At any time, you may save your program asprogram36 in
cert\programs. Write a SAS program that will clean the data incert.input36as follows:
Step 1:
create a temporary data set, cleandata36.
In this data set, convert all case.
Then keep only observations with group equal to 'A' or 'B'.
Step 2:
Determine the MEDIAN value for the Kilograms variable for each group(A,B) in the cleandata36
data set. Round MEDIAN to the nearest whole number.
Step 3:
Create results.output36 from cleandata36
Ensure that all values for variable Kilogramsare between 40 and 200, inclusively.
If the value is missing or out of range, replace the value with the MEDIAN Kilograms value for the
respectivegroup(A,B) calculated in step 2
86.5
Explanation:
SIMULATION
Scenario:
Open the existing program, program44.sasfrom folder cert\errors. At any time, you may save your
corrected program asprogram44incert\programs. This program is intended to:
O Create a new data set using thecert.input44set as input
O Drop variables:bp_status, weight_status, andsmoking _status.
o Create a new column,chol_status, based on the following values of cholesterol:
less than 200: "Safe"
200-239: "High - Borderline"
240 and higher: "High" oShould not calculatechol_statusfor missing cholesterol values There are
multiple errors in the program. These may be syntax errors, logic errors, or problems with the
program structure. Logic errors might not produce messages in the log, but will cause the program to
produce results different than intended. Correct the errors, run the program, and then use the results
to answer the next 3 questions. How many variables are in thework. outdata set? Enter your numeric
answer in the space below:
5
Explanation:
SIMULATION
Scenario:
Open the existing program, program48.sasfrom folder cert\errors. At any time, you may save your
corrected program asprogram48incert\programs. This program is intended to:
O Create 3 groups for C var: A-G is Group=1; H-N is Group=2; O-Z is Group=3.
O All variations of the variable should be in the same group, i.e. "A" and "a" should be in Group=1.
O Calculate the average of X and Y by Group. There are multiple errors in the program. These may be
syntax errors, logic errors, or problems with the program structure. Logic errors might not produce
messages in the log, but will cause the program to produce results different than intended. Correct
the errors, run the program, and then use the results to answer the next 2 questions. What is the
average (mean) of X for Group=2? Enter your answer to the nearest whole number. Enter your
numeric answer in the space below:
47
Explanation:
Which statement about SAS libraries is true? Select one:
B
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:
B