ElearnSAS.com

ElearnSAS.com
SAS Learning Platform

Base SAS 110

The following SAS program is submitted and reads 100 records from a raw data file:
data work.total;
infile 'file-specification' end = eof;
input name $ salary;
totsal + salary;

run;
Which one of the following IF statements writes the last observation to the output data set?
A. if end = 0;
B. if eof = 0;
C. if end = 1;
D. if eof = 1;
Click Comment link to get answer

15 comments:

  1. Anonymous9:10 AM

    Please explain

    ReplyDelete
  2. Anonymous10:32 AM

    end is sas keyword which will become true when SAS reads last record of a dataset. This value you cannot use directly in your program, so we create a alias name eof (end of file), but you can name it anything. EOF will carry the same value as internal variable END. So as we know 1=true and 0= false. if EOF = 1; will output only the last observation. Answer is D

    ReplyDelete
  3. Anonymous1:59 PM

    Use of 'eof' with an infile statement tends to confuse folks. Infile has both "END" and "EOF" options. A better question would make "end=lastrow". Then "if lastrow = 1" or "if lastrow".
    http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000146932.htm

    ReplyDelete
  4. 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
  5. Anonymous10:38 PM

    This is a poorly written question. The answer could be B or D depending on whether the eof is on the last line or another line after that.

    In other words, are there blank lines after data listing in the file?

    if eof on is on the last line then D is the correct answer, otherwise the answer is B.

    ReplyDelete
  6. Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.
    sas data analytics training with placement support

    ReplyDelete
  7. I have been searching for SAS interview question and answers.This blog is very useful and informative.

    Thanks for sharing.
    SAS Certification

    ReplyDelete