7. Why D? I think A and D are both wrong.
Which one of the following programs contains a syntax error?
A. proc sql;
select product.*, cost.unitcost, sales.quantity
from product p, cost c, sale s
where p.item = c.item and p.item = s.item;
quit;
B. proc sql;
select product.*, cost.unitcost, sales.quantity
from product , cost , sale
where product.item = cost.item and product.item = sales.item;
quit;
C. proc sql;
select p.*, cost.unitcost, sales.quantity
from product as p , cost as c , sale as s
where p.item = c.item and p.item = s.item;
quit;
D. proc sql;
select p.*, cost.unitcost, sales.quantity
from product , cost , sale
where product.item = cost.item and product.item = sales.item;
quit;
14. Why D?
Consider the following SAS log:
229 data sasuser.ranch sasuser.condo / view = sasuser.ranch;
230 set sasuser.houses;
231 if style='RANCH' then output sauser.ranch;
232 else if style='CONDO' then output sasuser.condo;
233 run;
NOTE: DATA STEP view saved on file SASUSER.RANCH. NOTE:
A stored DATA STEP view cannot run under a different operating system.
234 235 proc print data = sasuser.condo;
ERROR: File sasuser.condo data does not exist.
236 run;
NOTE: The SAS system stopped processing this step because of errors.
Which one of the following explains why the PRINT procedure fails?
A. sasuser.condo is a stored DATA STEP program.
B. A SAS data file and SAS data view cannot be created in the same DATA STEP.
C. A second VIEW= sasuser.condo OPTION was omitted on the DATA statement.
D. The view sasuser.ranch must be processed before sasuser.condo is created.
21. Why D not C?
The following SAS program is submitted:
%let lib = %upcase (sasuser);
pro sql;
select nvar from dictonary.tables
where libname = "&lib";
quit;
Given that several SAS data sets exist in the SASUSER library, which one of the following is generated as output?
A. no result set
B. a syntax error in the log
C. a report showing the names of each table in SASUSER
D. a report showing the number of columns in each table in SASUSER
22. Why A?
Given the following SAS data set ONE:
ONE GROUP SUM
A 765
B 123
C 564
The following SAS program is submitted:
data _null_;
set one;
call symput (group, sum);
run;
Which one of the following is the result when the program finishes execution?
A. Macro variable C has a value of 564.
B. Macro variable C has a value of 1452.
C. Macro variable GROUP has a value of 564.
第22题。
symput要生成的宏变量名字是group,但是SAS同时处理的数据集中有个变量名也是group,所以symput真正生成的宏变量的名字是“group变量当前的value"。最终是不存在宏变量group的。
data步每处理一条观测,宏变量"group的value"的值就会被刷新一次。data步处理的最后一条观测是C 564,
所以最后生成一个宏变量C,它的值是当前观测中sum的值564.
Macro variable C has a value of 564。