The following SAS program is submitted:
data work.january;
set work.allmonths (keep = product month num_sold cost);
if month = 'Jan' then output work.january;
sales = cost * num_sold;
keep = product sales;
run;
set work.allmonths (keep = product month num_sold cost);
if month = 'Jan' then output work.january;
sales = cost * num_sold;
keep = product sales;
run;
Which variables does the WORK.JANUARY data set contain?
A. PRODUCT and SALES only
B. PRODUCT, MONTH, NUM_SOLD and COST only
C. PRODUCT, SALES, MONTH, NUM_SOLD and COST only
D. An incomplete output data set is created due to syntax errors.
A. PRODUCT and SALES only
B. PRODUCT, MONTH, NUM_SOLD and COST only
C. PRODUCT, SALES, MONTH, NUM_SOLD and COST only
D. An incomplete output data set is created due to syntax errors.
7 comments:
Answer: D
keep = product sales; causes a syntax error… A keep statement syntax does not have a = .
data work.january;
infile cards;
input product $ month $ num_sold cost;
if month = 'Jan' then output work.january;
sales = cost * num_sold;
keep product sales;
cards;
A Jan 10 20
B Feb 20 30
;
run;
Correct Answer is (A). Question is asking about "Which variables does the WORK.JANUARY data set contain" and PRODUCT and SALES do appear in the incomplete dataset.
Yeah. But I think this is going for which is the better answer and I have to agree with SASGuru. If you opened up the data set, it might have those variables listed as column names, but they should empty because the program will have failed to compile properly and not been able to fill them.
Answer = A
the program has data errors not syntax errors mentioned on answer D
D.
To SasGuru
data work.january;
infile cards;
input product $ month $ num_sold cost;
if month = 'Jan' then output work.january;
sales = cost * num_sold; /*statement place here produce missing value; if the statement moved before IF statement will provide numeric/*
keep product sales;
cards;
A Jan 10 20
B Feb 20 30
;
run;
agree with SasGuru. Answer is D. it shows syntax error.
I agree that there is a syntax error but the sas data set work.january still exist with 6 variables.
add proc contents to list the variables of work.january. The quiestion is: Which variables does the WORK.JANUARY data set contain? and "6" is not a choice
I think the question is flawed.
Post a Comment