The following SAS program is submitted: data work.one; x = 3; y = 2; z = x ** y; run; Which one of the following is the value of the variable Z in the output data set?
Question : The SAS data set named WORK.TEST is listed below: capacity airplanetype staff 150 Large 10
Which one of the following SAS programs created this data set? A. data work.test; capacity = 150; if 100 le capacity le 200 then airplanetype = 'Large' and staff = 10; else airplanetype = 'Small' and staff = 5; run;
B. data work.test; capacity = 150; if 100 le capacity le 200 then do; airplanetype = 'Large'; staff = 10; end; else do; airplanetype = 'Small'; staff = 5; end; run;
C. data work.test; capacity = 150; if 100 le capacity le 200 then do; airplanetype = 'Large'; staff = 10; else do; airplanetype = 'Small'; staff = 5; end; run;
D. data work.test; capacity = 150; if 100 le capacity le 200 then; airplanetype = 'Small'; staff = 5; else; airplanetype = 'Large'; staff = 10; run;
Explanation: In A you have tis line in error airplanetype = 'Large' and staff = 10;
In C you have a Structure Problem
and In D the condition is reverse If we would perform more than one action under an if statement, we should use do-end loop whithin.
So the answer is 2
Question :
The SAS data sets WORK.EMPLOYEE and WORK.SALARY are listed below: WORK.EMPLOYEE WORK.SALARY fname age fname salary Bruce 30 Bruce 25000 Dan 40 Bruce 35000 Dan 25000 The following SAS program is submitted: data work.empdata; merge work.employee work.salary; by fname; totsal + salary; run; How many variables are output to the WORK.EMPDATA data set?
Explanation: : if work.employee had Dan & his salary info then the Ans wd be B:
Obs fname age salary totsal 1 Bruce 30 25000 25000 2 Bruce 30 35000 60000 3 Dan 40 . 60000 4 Dan 25000 . 60000 The Variables are: Fname, age, salary and totsal (i.e 4 variables) Note: Obs will not be counted here