Due May 12 at 11:59pm.
Submit a single document named like this: THMidtermSmithStan.docx or THMidtermSmithStan.txt (replace Stan by your first name and Smith by your family name). Put everything in this document, including your answers to the multiple choice questions in Part A and your source code and output for Part B. Problems 1, 3, 4, and 5 in Part B also require additional discussion.
Part A: Multiple Choice Questions In addition to indicating the letter of the correct answer for each question, provide an explantion of how you obtained your answer. Although you may be able to check some of the answers by running SAS source code, the SAS output by itself is not a sufficient explanation of how you obtained your answer. If you think that none of the answers is correct, indicate "None of the above" for your answer and explain why. For each multiple choice question, the reason is worth 4 points; the correct answer is worth 1 point.
input @1 prod_id $6. @7 prod_name $15. @23 price 6.2;a. Column b. Formatted c. List d. Mixed
input a $ b #3 c $ d;a. Moves the column pointer three columns to the right.
data test; input name $ age @; datalines; Alice +11 Caleb +12 ; proc print; run; a. Obs name age b. Obs name age 1 Alice . 1 Alice 11 c. Obs name age d. Obs name age 1 Alice . 1 Alice 11 2 Caleb . 2 Caleb 12
data test; do n = 1 to 3; sum = 0; do m = 1 to 4; sum + m; end; end; drop m; proc print; run; a. Obs n sum b. Obs n sum 1 1 . 1 1 10 2 2 . 2 2 10 3 3 . 3 3 10 c.Obs n sum d. Obs n sum 1 3 10 1 4 10
Dataset one: Dataset two: Obs id char1 Obs id char2 1 31 A 1 31 D 2 52 B 2 48 E 3 85 C 3 77 F 4 85 GWhat is the first observation of the dataset merged after this script is executed? Explain why the answer you choose is correct.
data merged; merge one two; by id; run; a. Obs id char1 char2 b. Obs id char1 char2 1 31 A 1 31 D c. Obs id char1 char2 d. Obs id char1 char2 1 31 A D 1 85 C G
Obs s x 1 A 81 2 C 31 3 B 58 4 A 9 5 A 20After this script is run, how many observations are in the dataset one? Explain why the answer you choose is correct.
data one two; set orig; if s = 'A' then output one; output; run;a. 0 b. 3 c. 5 d. 8
a. proc means data=orig; b. proc means data=orig; by s; class s; c. proc means data=orig; d. proc means data=orig; when s; var s;
data orig; input factor1 $ factor2 $ count; datalines; A C 128 A D 326 B C 93 B D 207 ; proc freq; table factor1 * factor2 / nopercent nocol norow nocum; weight count; run; ----------------------------------- a. factor2 Frequency C D Total +---+---+ A | 1 | 1 | 2 factor1 +---+---+ B | 1 | 1 | 2 +-------+ Total 1 2 4 ----------------------------------- d. factor2 Frequency C D Total +-------+-------+ A | 1 | 1 | 2 | 50.00 | 50.00 | 50.00 factor1 +-------+-------+ B | 1 | 1 | 2 | 50.00 | 50.00 | 50.00 +-------+-------+ Total 1 2 4 50.00 50.00 100.00 ----------------------------------- c. factor2 Frequency C D Total +-----+-----+ A | 128 | 326 | 454 factor1 +-----+-----+ B | 93 | 207 | 300 +-----+-----+ Total 221 533 754 ----------------------------------- d. factor2 Frequency C D Total +-------+-------+ A | 128 | 326 | 454 | 16.98 | 43.24 | 60.21 factor1 +-------+-------+ B | 93 | 207 | 300 | 12.33 | 27.45 | 39.79 +-------+-------+ Total 221 533 754 29.31 70.69 100.00
Part B: Problems