Hello!
I am working with some data to calculate FTE hours based off business days in a given month (excluding weekends and standard US holidays).
My data is layed out as follows -
For example
PRID | ProjectID | ResourceID | AllocYear | AllocJan | AllocFeb | AllocMar | AllocApr | AllocMay | AllocJun | AllocJul | AllocAug | AllocSep | AllocOct | AllocNov | AllocDec |
6002198 | 5728091 | 5181017 | 2017 | 32 | 32 | 36.8 | 32 | 35.2 | 35.2 | 16 | 0 | 0 | 0 | 0 | 0 |
I need to determine based off the current date(7/20/17) - what is the correct month variable to use(AllocJul) and what year (AllocYear) to use.
and then calculate the percentage of FTE hours based on the following
Business days in current month (July 2017 has 20 days) and multiply that (20 *8) 8 being the standard number of hours a full time FTE works per day and then divide that by the number in the current Alloc month column.
It would be (20*8) = 160 and 16 for AllocJul in the example above
Would be 160/16 = 10
Is there a way in sas to do this?
Thank you in advance for your help!
Angie Miller
Use an Array:
data want (keep=prid projectid resourceid alloc);
set have;
where allocyear = year(today);
array months {*} allocjan-allocdec;
alloc = months{month(today())};
run;
Use an Array:
data want (keep=prid projectid resourceid alloc);
set have;
where allocyear = year(today);
array months {*} allocjan-allocdec;
alloc = months{month(today())};
run;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.