ElearnSAS.com

ElearnSAS.com
SAS Learning Platform

Base SAS 10

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

47 comments:

  1. Anonymous1:03 AM

    The answer is D

    ReplyDelete
  2. The answer is D.
    As there is syntax error.
    "keep = product sales" which is the incorrect way to use KEEP option.

    ReplyDelete
    Replies
    1. Should write as 'keep product sales;'?

      Delete
    2. The keep statement is correct but DROP= should be used on a SET file.
      KEEP can be used on the file work.january.
      The Answer is D.

      Delete
  3. Anonymous1:43 AM

    Correct Answer is D

    ReplyDelete
  4. Anonymous5:45 PM

    Sharad, Not Keep option, Keep statement

    ReplyDelete
  5. Anonymous3:47 PM

    It creates a variable named keep also!. It is not a mistake to put keep=something because SAS takes it as a new variable

    ReplyDelete
  6. Anonymous5:41 PM

    But Andrea here it is

    Keep = Product sales;

    ReplyDelete
  7. Keep=options is used in an inappropriate place

    ReplyDelete
    Replies
    1. Y DONT YOU NEED A KEEP= ?? THE SYNTAX IS KEEP= OR DROP=

      Delete
  8. swapna6:52 PM

    the correct answer is D. Some syntax errors during data step will not stop execution.

    ReplyDelete
  9. Anonymous6:34 PM

    the keep statement don't need '='

    ReplyDelete
  10. Anonymous9:57 PM

    I think the answer should be B.
    There is no syntax error with the Keep=.

    Can the admin plz confirm the right answer?

    ReplyDelete
  11. Anonymous9:28 AM

    try to run the program in SAS and you will know that answer is D.

    ReplyDelete
  12. Anonymous8:46 PM

    Sakar Sham:

    Guys 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?

    ReplyDelete
    Replies
    1. Anonymous6:43 AM

      We can output a data set with if condition

      Delete
    2. Anonymous3:33 PM

      statement like in (1) is correct.

      Delete
  13. the mistake is in conditional statement..
    it 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

    ReplyDelete
  14. Anonymous2:16 PM

    Nehal;
    We 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.

    ReplyDelete
  15. Anonymous2:20 PM

    Thank you.Andrea! I got the reason clearly, sakar was not clear, though he had good point and elaborated it.

    if 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?

    ReplyDelete
  16. Anonymous7:35 PM

    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.

    ReplyDelete
  17. Anonymous3:58 PM

    The 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):

    303 keep = years years_service;
    ----
    180

    ERROR 180-322: Statement is not valid or it is used out of proper order.

    304 run;

    ReplyDelete
  18. Anonymous4:04 PM

    No, the correct answer is D as the program expects an operator between the two variables in the keep = statement.

    ReplyDelete
  19. Anonymous11:18 PM

    Answer is D cuz here assignment statement is used after output,

    ReplyDelete
  20. Anonymous3:46 PM

    D IS CORRECT

    data 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

    ReplyDelete
    Replies
    1. Anonymous9:15 PM

      We know it is a syntax error, the issue is exactly which part of the code?

      Delete
    2. SAS 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

      Delete
  21. This comment has been removed by the author.

    ReplyDelete
  22. thehipyogi10:05 PM

    data allmonths;
    product = '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;



    ReplyDelete
  23. thehipyogi10:07 PM

    The SAS System 18:05 Monday, February 15, 2010 17

    Obs 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


    ReplyDelete
  24. Anonymous11:25 AM

    the answer is d

    ReplyDelete
  25. Anonymous10:34 PM

    Answer: D

    Try 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

    ReplyDelete
  26. Anonymous12:51 PM

    Where do you guys get Base SAS 10? I know of SAS 9.

    ReplyDelete
  27. So which one is correct B/D?

    ReplyDelete
  28. Anonymous11:36 PM

    Even D is true, it does not answer the question "Which variables does the WORK.JANUARY data set contain?".
    If it is an incomplete dataset, it still contains some variables. Which variables? D does not answer the question.

    ReplyDelete
  29. Anonymous8:57 AM

    The dataset will have the following (empty) variables.
    product, 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.

    ReplyDelete
  30. For latest and updated SAS certification dumps in PDF format contact us at completeexamcollection@gmail.com.
    Refer our blog for more details: http://completeexamcollection.blogspot.in/2015/12/sas-certification-dumps.html

    ReplyDelete
  31. When the syntax errors are detected during the compilation phase then why the incomplete datasets are created at first place ?

    ReplyDelete
  32. This comment has been removed by the author.

    ReplyDelete
  33. Good 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.
    gclub
    gclub casino online

    ReplyDelete
  34. 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.

    SAS Online Training

    ReplyDelete
  35. Need much more detailed information about the ISO certification and benefits of it for the business.

    ISO certification services in india

    ReplyDelete
  36. So whats the answer?
    B or D
    I think it shoud be B because dataset is already greated before the iteration of keep stmt

    ReplyDelete
  37. 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
  38. Thanks for sharing this great content. It is really informative and useful., You can also check this Similar site ISO Training Center in India

    ReplyDelete