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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.