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;
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.
Click Comment link to get answer
The answer is D
ReplyDeleteThe answer is D.
ReplyDeleteAs there is syntax error.
"keep = product sales" which is the incorrect way to use KEEP option.
Should write as 'keep product sales;'?
DeleteThe keep statement is correct but DROP= should be used on a SET file.
DeleteKEEP can be used on the file work.january.
The Answer is D.
Answer D
ReplyDeleteCorrect Answer is D
ReplyDeleteSharad, Not Keep option, Keep statement
ReplyDeleteIt creates a variable named keep also!. It is not a mistake to put keep=something because SAS takes it as a new variable
ReplyDeleteBut Andrea here it is
ReplyDeleteKeep = Product sales;
Keep=options is used in an inappropriate place
ReplyDeleteY DONT YOU NEED A KEEP= ?? THE SYNTAX IS KEEP= OR DROP=
Deletethe correct answer is D. Some syntax errors during data step will not stop execution.
ReplyDeletethe keep statement don't need '='
ReplyDeleteI think the answer should be B.
ReplyDeleteThere is no syntax error with the Keep=.
Can the admin plz confirm the right answer?
try to run the program in SAS and you will know that answer is D.
ReplyDeleteSakar Sham:
ReplyDeleteGuys Correct answer is "D", but wanted to read logic. If we see similar question, can come to a logic.
It has syntax error is it due to
1) if month = 'Jan' then output work.january; or
2) keep = product sales;
For sure if it is with data line ( drop = variables) and no need = in the body separately.
I have never read any statement like in (1), output is a data set, which one is the reason? or both are the reasons?
Your logic is appreciated?
We can output a data set with if condition
Deletestatement like in (1) is correct.
Deletethe mistake is in conditional statement..
ReplyDeleteit is already creating datastep tht is january in first statement and also creating in if statement so there is syntax error...so answer is D
Nehal;
ReplyDeleteWe agreed the syntax error ? Can any body be precise and hit the bulls eye? As sakar said , in the body there is no need for " = ' sign for drop or keep onless it is in data statement.If that is not the reason , can you give us your logic?
thank you.
Thank you.Andrea! I got the reason clearly, sakar was not clear, though he had good point and elaborated it.
ReplyDeleteif we have a statement keep = variables, then SAS is looking for new variables, does it encounters with previous variables and gives the syntax error? Can you elaborate more?
The right answer is B.In order for a keep statement to be used in a data step,it is stated as Keep product sales and not Keep = product sales.Here keep= product sales is like an assignment statement.
ReplyDeleteThe answer is B for the same reason mentioned above! Since the syntax error occurs after january dataset is created, the dataset will be created and the log will display a syntax error like this (An example):
ReplyDelete303 keep = years years_service;
----
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
304 run;
No, the correct answer is D as the program expects an operator between the two variables in the keep = statement.
ReplyDeleteAnswer is D cuz here assignment statement is used after output,
ReplyDeleteD IS CORRECT
ReplyDeletedata work.january;
5 set work.allmonths (keep = product month num_sold cost);
6 if month = 'Jan' then output work.january;
7 sales = cost * num_sold;
8 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, ^=, |, ||, ~=.
9 run;
NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
8:8
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.JANUARY may be incomplete. When this step was stopped there were 0 observations and 6
variables.
NOTE: DATA statement used (Total process time):
real time 0.04 seconds
cpu time 0.01 seconds
We know it is a syntax error, the issue is exactly which part of the code?
DeleteSAS expecting an arithmetic operator between the product and sales variables in the keep= assignment statement .. its considering keep as a new variable in this case and will stop the data step due to syntax error caused by a lack of an arithmetic operator between the 2 variables mentioned above .. now depending on the number of observations in the input dataset and the options setting for maximum errors (options errors=) the dataset will be created but will probably be incomplete ... so D
DeleteThis comment has been removed by the author.
ReplyDeletedata allmonths;
ReplyDeleteproduct = 'blanket';
month = 'jan';
num = 100;
cost = 5;
run;
data work.january;
set allmonths (keep = product month num cost);
if month = 'jan' then output work.january;
sales = cost*num;
keep = product sales;
run;
proc print data = work.january;
run;
The SAS System 18:05 Monday, February 15, 2010 17
ReplyDeleteObs product month num cost sales
1 blanket jan 100 5 .
That means all the variables are there in the output data set. The log does give errors. But the program excutes for sure
the answer is d
ReplyDeleteAnswer: D
ReplyDeleteTry the problem at the link below for additional Base SAS Certification example questions. Good luck!
http://sascert3.blogspot.com/2013/04/base-sas-certification-example-question_17.html
-SAS Cert
Where do you guys get Base SAS 10? I know of SAS 9.
ReplyDeleteSo which one is correct B/D?
ReplyDeleteEven D is true, it does not answer the question "Which variables does the WORK.JANUARY data set contain?".
ReplyDeleteIf it is an incomplete dataset, it still contains some variables. Which variables? D does not answer the question.
The dataset will have the following (empty) variables.
ReplyDeleteproduct, month, num, cost, sales, keep.
cos the variables has no values - >answer D
In the logg will sas write:
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.JANUARY may be incomplete. When this step was stopped there were 0 observations and 6 variables.
For latest and updated SAS certification dumps in PDF format contact us at completeexamcollection@gmail.com.
ReplyDeleteRefer our blog for more details: http://completeexamcollection.blogspot.in/2015/12/sas-certification-dumps.html
When the syntax errors are detected during the compilation phase then why the incomplete datasets are created at first place ?
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteGood Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeletegclub
gclub casino online
Everyone wants to get unique place in the IT industry’s for that you need to upgrade your skills, your blog helps me improvise my skill set to get good career, keep sharing your thoughts with us.
ReplyDeleteSAS Online Training
Need much more detailed information about the ISO certification and benefits of it for the business.
ReplyDeleteISO certification services in india
So whats the answer?
ReplyDeleteB or D
I think it shoud be B because dataset is already greated before the iteration of keep stmt
Enthusiastic words written in this blog helped me to enhance my skills as well as helped me to know how I can help myself on my own. I am really glad to come at this platform.
ReplyDeleteรับ ทํา สติ๊กเกอร์ ติด สินค้า
D
ReplyDeleteThanks for sharing this great content. It is really informative and useful., You can also check this Similar site ISO Training Center in India
ReplyDelete