ElearnSAS.com

ElearnSAS.com
SAS Learning Platform

Base SAS 52

The following SAS program is submitted:
data work.total;
set work.salary(keep = department wagerate);
by department;
if first.department then payroll = 0;
payroll + wagerate;
if last.department;
run;
The SAS data set WORK.SALARY, currently ordered by DEPARTMENT, contains 100 observations for each of 5 departments.
Which one of the following represents how many observations the WORK.TOTAL data set contains?
A. 5
B. 20
C. 100
D. 500
Click Comment link to get answer

9 comments:

  1. nidhi1:03 PM

    can anyone explain how?

    ReplyDelete
  2. The most important statement in the program for this question is if last.department;
    We will get output only if last.department becomes true and we know there are five departments and data is sorted by department so last.department will become true 5 times and thus 5 observation in output.

    ReplyDelete
    Replies
    1. Anonymous12:42 AM

      The data is sorted by department, thus we can think there are five subgroup in the dataset: dep1-dep5. Within each group, sas computes the payroll+wagerate value, and sas outputs observations when it reaches the last observation in each subgroup. Thus there will be five observations.

      Delete
  3. Anonymous10:57 AM

    You're right SAScert

    ReplyDelete
  4. If you want to implement your payroll system check this Payroll Philippines

    ReplyDelete