BookmarkSubscribeRSS Feed
IV
Calcite | Level 5 IV
Calcite | Level 5
Hi guys

I need some help with a question coming from SAS base exam.

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;


Question:
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?


From what i seen the answer is 5.

But i really need some explaination on this.

thanks in advance

IV
2 REPLIES 2
Ksharp
Super User
Yes .it is five.
because
if last.department; means if last.department then output; So only five obs be output.

Ksharp
IV
Calcite | Level 5 IV
Calcite | Level 5
hi thanks very much

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1556 views
  • 0 likes
  • 2 in conversation