b****u 发帖数: 67 | 1 问题一
看不出毛病呀, 答案D也不work 呀?
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;
/*********/
问题二
我机器上run出来是B呀,为什莫答案是C 呢?
谢谢
7. Given the SAS data sets ONE and TWO:
ONETWO
YEARQTRBUDGETYEARQTRSALES
20013 50020014 300
20014 40020012 200
20021 70020021 600
The following SAS program is submitted:
proc sql;
select one.*, sales
from one, two
where one.year = two.year;
quit;
Which report is generated?
A.YEAR QTR BUDGET SALES
TestInside A00-212
2001 4 400 300
2002 1
B.YEAR QTR BUDGET SALES
2001 3 500 300
2001 4 400 200
2002 1 700 600
C.YEAR QTR BUDGET SALES
2001 3 500 300
2001 3 500 200
2001 4 400 300
2001 4 400 200
2002 1 700 600
D.YEAR QTR BUDGET SALES
2001 3 500 300
2001 4 400 300
2002 1 700 300
2001 3 500 200
2001 4 400 200
2002 1 700 200
2001 3 500 600
2001 4 400 600
2002 1 700 600
Answer: C | d******9 发帖数: 404 | 2 Question 2:
C is correct. 5 obs because SQL built a Cartesian product.
See the below SAS output.
data one;
input year $ qtr budget;
cards;
2001 3 500
2001 4 400
2002 1 700
;
run;
data two;
input year $ qtr sales;
cards;
2001 4 300
2001 2 200
2002 1 600
;
run;
proc sql;
select one.*, sales
from one, two
where one.year = two.year;
quit;
======================
The SAS System 23:32 Wednesday, April 1, 2009 1
year qtr budget sales
ƒƒƒƒƒƒƒ
402;ƒƒƒƒƒƒƒƒƒƒƒƒ
ƒƒƒƒƒƒƒƒƒƒƒƒ
402;ƒƒƒƒƒ
2001 3 500 300
2001 3 500 200
2001 4 400 300
2001 4 400 200
2002 1 700 600 | d******9 发帖数: 404 | 3 Question 1:
Not sure.I suggest u go to SAS web to learn about the %BQUOTE function. |
|