ElearnSAS.com

ElearnSAS.com
SAS Learning Platform

Base SAS 8

The following SAS program is submitted:
data work.totalsales (keep = monthsales{12} );
set work.monthlysales (keep = year product sales);
array monthsales {12} ;
do i=1 to 12;
monthsales{i} = sales;
end;
run;
The data set named WORK.MONTHLYSALES has one observation per month for each of five years for a total of 60 observations.
Which one of the following is the result of the above program?
A. The program fails execution due to data errors.
B. The program fails execution due to syntax errors.
C. The program executes with warnings and creates the WORK.TOTALSALES data set.
D. The program executes without errors or warnings and creates the WORK.TOTALSALES data set.
Click Comment link to get answer

22 comments:

  1. Anonymous12:25 PM

    Answer is B.
    data monthly (keep = sales);
    do i = 1 to 60;
    sales = i*10;
    output;
    end;
    run;
    data work.totalsales(keep = msales{12} ) ;
    set work.monthly (keep = sales);
    array msales {12} ;
    do i=1 to 12;
    msales{i} = sales;
    end;
    run;

    log file:
    153 data work.totalsales(keep = msales{12} ) ;
    -
    214
    23
    ERROR 214-322: Variable name { is not valid.

    ERROR 23-7: Invalid value for the KEEP option.

    --
    23
    -
    23
    153! data work.totalsales(keep = msales{12} ) ;
    --
    214
    ERROR 214-322: Variable name 12 is not valid.

    153! data work.totalsales(keep = msales{12} ) ;
    -
    214
    ERROR 214-322: Variable name } is not valid.

    Program will run without errors if we change keep = statement as
    data work.totalsales(keep = msales1-msales12 ) ;
    set work.monthly (keep = sales);
    array msales {12} ;
    do i=1 to 12;
    msales{i} = sales;
    end;
    run;

    ReplyDelete
  2. Anonymous2:12 PM

    syntax error - coz there is no variable as monthsale{12}...the variable is monthsale12

    ReplyDelete
  3. the answer might be Invalid value for the KEEP option.

    ReplyDelete
  4. Anonymous2:21 PM

    correct answer B

    ReplyDelete
  5. swapna7:09 PM

    The answer is B

    ReplyDelete
  6. madhuri6:59 AM

    yap B is correct one bez it is d syntax error

    ReplyDelete
  7. aniket6:21 AM

    ans is B...

    ReplyDelete
  8. ans is B as there is error in the first data step. no proper execution

    ReplyDelete
  9. Anonymous4:15 AM

    the answer is b syntax errror.
    we can't use array variables in the keep/drop options because array variables are temporary and available only at the time of execution. we have to mention the name of the variables created by array if required in the keep option.

    ReplyDelete
  10. Answer: b

    Check out my latest Base SAS Certification practice question at the link below. If you can answer these questions you can pass the Base SAS Certification!

    http://sascert3.blogspot.com/2013/04/base-sas-example-question-61.html

    Good luck!

    ReplyDelete
  11. How about (keep=months ales)?

    ReplyDelete
  12. Anonymous11:29 PM

    What is the difference between Data error and Syntax error?

    ReplyDelete
  13. Anonymous11:58 PM

    I agree that the array causes and error, but this seems like a data error to me, not a syntax error! Can anyone elaborate?

    ReplyDelete
  14. (Keep=monthsales1-monthsales12) will work.

    ReplyDelete
  15. Anonymous1:20 PM

    we have to mention the name of the variables created by array if required in the keep option.
    บาคาร่า
    gclub casino
    gclub จีคลับ

    ReplyDelete
  16. Thanks for providing this information,Thanks for your sharing.

    ดูหนังออนไลน์

    ReplyDelete
  17. I am grateful for this blog to distribute knowledge about this significant topic. Here I found different segments and now I am going to use these new instructions with new enthusiasm.ระบบขาย

    ReplyDelete
  18. This Is Really Useful And Nices Information. ไฮโล
    This are such great articles. ไฮโล This articles can help you to make some new ideas.
    https://soccersurfer98.hatenablog.com/entry/2020/09/02/132139?_ga=2.193217001.552343305.1598844608-1286484823.1596077192 I appreciate for reading my blogs.

    ReplyDelete
  19. oh god อเมริกันฟุตบอลthat was amazing article อเมริกันฟุตบอลthis was the of article of the year

    อเมริกันฟุตบอล I never seen the article like this อเมริกันฟุตบอล I love to see the best article of the year like this I hope to contract with writter for bussiness

    ReplyDelete
  20. อเมริกันฟุตบอล I like this article so much อเมริกันฟุตบอล this topic was awesome อเมริกันฟุตบอล I love to see the tecnique of writer in this post

    ReplyDelete
  21. Hi, i think that i noticed you visited my web site so i got here to return the prefer?.I am trying to in finding things to enhance my web site!I guess its good enough to use some of your ideas!!

    ReplyDelete