## Dates of Salaries

Solved
Occasional Contributor
Posts: 19

# Dates of Salaries

Hi guys,

I have information on employees' salaries and the end and start date of the time they worked at the company. I wish to work out the Total Sum of Salaries for 2014, but many staff left halfway through the year so they only get a percentage of their whole salary. So how do I find out the percentage of the salary they got and then sum it together to get the Sum of Salaries using the Query Builder?  q

Thanks

Accepted Solutions
Solution
‎04-27-2015 11:05 AM
Super User
Posts: 13,926

## Re: Dates of Salaries

t2.end_date- '01jan2014'd

The underlined part is a date literal, which means one that humans understand. The internal numeric value that SAS uses for that date is 19724.

All Replies
Super User
Posts: 13,926

## Re: Dates of Salaries

Actually if this was my project I would take the information to calculate a daily rate (unless hourly seems more appropriate and that information is available, The calculate the number of days as

DaysAtSalary = EndDate - StartDate; /* assumes you have SAS date values*/

Then using any of the report procedures such as Proc Report, Tabulate or even Means ask for the sum of the daily salary values and WEIGHT by the number of days at that salary.

Occasional Contributor
Posts: 19

## Re: Dates of Salaries

The StartDates go way back, not to 2014 which is the only year that I want to find out about. I have tried to make a new column in the Query Builder with the expression so that I can find out how many days they have worked in 2014.

t2.end_date-01jan2014

But I keeps on saying that Query Syntax is not valid

Super User
Posts: 13,926

## Re: Dates of Salaries

us '01JAN2014'd the quotes and d tell sas to treat the value as a date literal.

OR you can get the day of the year as Mod(juldate(t2.end_date),1000)

Occasional Contributor
Posts: 19

## Re: Dates of Salaries

How do I treat date as literal?

Solution
‎04-27-2015 11:05 AM
Super User
Posts: 13,926

## Re: Dates of Salaries

t2.end_date- '01jan2014'd

The underlined part is a date literal, which means one that humans understand. The internal numeric value that SAS uses for that date is 19724.

🔒 This topic is solved and locked.