DATA Step, Macro, Functions and more

How to set up a tracking system to track your vacation time?

Reply
Super Contributor
Posts: 1,636

How to set up a tracking system to track your vacation time?

Hi All,

If you get 10 hours vacation time each month and the maximum allowed is 100 hours. Is it possible to track the time  by SAS?

Thank you!

Respected Advisor
Posts: 3,124

Re: How to set up a tracking system to track your vacation time?

LinLin,

Some details may help. Such as 10 hours PTO per month, how you count it? it is calculated by workdays or hours  or just by month, so even you show up for only one day (say the last day of the month), you still get 10 hour PTO?  what is your incoming data look like? 

Haikuo

Valued Guide
Posts: 2,175

Re: How to set up a tracking system to track your vacation time?

Linlin

do you already record activities, or hours worked, in some way?

If so, we just need to extend that process....

PROC Star
Posts: 1,095

Re: How to set up a tracking system to track your vacation time?

Okay, let's have some fun.

I don't feel that SAS is all that great as a data entry solution, so how do you enter how many hours of holidays you've taken in a month?

Assuming we use the following code to calculate the vacation days available:

data VacationHours;
retain PotentialDays 0;
format StartDate CurrentDate date.;
StartDate = '08AUG1978'd;
CurrentDate = date();

do i = 1 to intck('MONTH', StartDate, CurrentDate);
  PotentialDays = PotentialDays + 10;
  ActualDays = min(PotentialDays, 100);
  output;
end;
run;

(For my actual start date of Aug 8, 1978, I should have 4,150 vacation days, but thanks to your harsh policies I only have 100!)

all we need to do is merge in the days taken, no?

Tom

PROC Star
Posts: 7,363

Re: How to set up a tracking system to track your vacation time?

@linlin: If you don't need a historical record, you might be able to get by with something simple like:

1. create the original file showing the hours you currently have:

libname art "c:\art";

data art.hours_have;

  input hours;

  cards;

95

;

2. create a program that you will run, say thru window's scheduler, on whichever day the new 10 hours are added:

libname art "c:\art";

data art.hours_have;

  hours=max(100,hours+10);

run;

3. create a macro to deduct hours taken:

%macro vacation(time);

  libname art "c:\art";

  data art.hours_have;

    set art.hours_have;

    hours=hours-&time.;

  run;

%mend vacation;

4. Run the macro each time you take a vacation:

%vacation(5)

Super Contributor
Posts: 1,636

Re: How to set up a tracking system to track your vacation time?

Thank you all for your time and help! I use an excel file similar to the attached file to track my vacation time. I am thinking of switching to SAS.

Ask a Question
Discussion stats
  • 5 replies
  • 274 views
  • 6 likes
  • 5 in conversation