By admin | August 9, 2009

SAS Certified Base Programmer 50 Questions (34)

The SAS data sets Work.Employee and Work.Salary are shown below.

Work.Employee
fname age
Bruce  30
Dan    40

Work.Salary
fname salary
Bruce  25000
Bruce  35000
Dan    25000

The following merged SAS data set is generated:

Work.Empdata
fname age totsal
Bruce  30   60000
Dan    40   25000

Which one of the following SAS programs created the merged data set?

a.

data work.empdata;
    merge work.employee
        work.salary;
    by fname;
    if first.fname then totsal=0;
    totsal+salary;
    if last.fname then output;
run;


b.

data work.empdata(drop=salary);
    merge work.employee
        work.salary;
    by fname;
    if first.fname then totsal=0;
    totsal+salary;
    if last.fname then output;
run;


c.

data work.empdata;
    merge work.employee
        work.salary(drop=salary);
    by fname;
    if first.fname then total=0;
    totsal+salary;
    if last.fname then output;
run;


d.

data work.empdata;
    merge work.employee
        work.salary;
    by fname;
    if first.fname then total+salary;
run;

One comment | Add One

  1. admin - 08/9/2009 at 8:30 pm

    B

Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *