85. Given the SAS data set OURDATA:
OURDATAObsproduct sales
1 OR 1000
2 NE 1200
3 MM 1450
After submitting a SAS program, the following is written to the SAS log:
70 %macro a;
71 data _null_;
72 set ourdata;
73 call symput('product'!!left(_n_), product);
74 run;
75 %if &product1 = OR %then %do;
76 proc means data = ourdata;
77 run;
78 %end;
79 %mend;
80 %a
NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
73:66
NOTE: There were 3 observations read from the data set WORK.OURDATA.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is
required. The condition was: &product1=OR
ERROR: The macro A will stop executing.
Which statement replaces the code in line 75 to successfully complete the program?
A.%if &product1 = %bquote(OR) %then %do;
B.%if %bquote(&product1) = OR %then %do;
C.%if %bquote(&product1 = OR) %then %do;
D.%if %bquote(&product1) = %bquote(OR) %then %do;
答案为什么是D?
当 product1 变成 OR 的时候问什么不能直接用 %if &product1 = OR 而要用 %bquote呢?
谢谢各位了