我的疑问在于,keep和drop的用法规律是一样的吗?如果是,为何第70题答案说如在set中则需要括号与等号,而第6题却要除去等号?
谢谢!
第6题
6.After a SAS program is submitted, the following is written to the SAS log:
101 data WORK.JANUARY;
102 set WORK.ALLYEAR(keep=product month num_Sold Cost);
103 if Month=’Jan’ then output WORK.JANUARY;
104 Sales=Cost * Num_Sold;
105 keep=Product Sales;
—–
22
ERROR 22-322: Syntax error, expecting one of the following: !,!!, &, *, **, +, -, , <=, <>, =, >, >=,
AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL,NOTIN, OR, ^=, |, ||, ~=.
106 run;
What changes should be made to the KEEP statement to correct the errors in the LOG?
A. keep=(Product Sales);
B. keep Product, Sales;
C. keep=Product, Sales;
D. keep Product Sales;
Answer: D
本文属于博客:http://www.crackman.net 版权归作者所有,如有转载,请注明出处!未经本作者同意不得用于商业应用。
其他本博客文章均作此声明!
本道题考察的是KEEP语句的语法问题
在括号内就是KEEP=
如果不是就是KEEP
第70题
70.After a SAS program is submitted, the following is written to the SAS log:
105 data WORK.JANUARY;
106 set WORK.ALLYEAR(keep=Product Month Quantity Cost);
107 if Month='JAN' then output WORK.JANUARY;
108 Sales=Cost * Quantity;
109 drop=Month Quantity Cost;
-----
22
ERROR 22-322: Syntax error, expecting one of the following: !,
!!, &, *, **, +, -,
, <=, <>, =, >, >=,
AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL,
NOTIN, OR, ^=, |, ||, ~=.
110 run;
What data set option could be attached to WORK.JANUARY to replace the DROP statement that generated the error in the log? A. (drop Month Quantity Cost)
B. (drop Month, Quantity, Cost)
C. (drop=Month, Quantity, Cost)
D. (drop=Month Quantity Cost)Answer: A
DROP语句,在DATA STATEMENT中,不需要等号
在SET 语句中,需要括号以及等号。