BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
agreekgod
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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.

View solution in original post

5 REPLIES 5
ballardw
Super User

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.

agreekgod
Calcite | Level 5

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

ballardw
Super User

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)

agreekgod
Calcite | Level 5

How do I treat date as literal?

ballardw
Super User

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.

sas-innovate-2024.png

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.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1018 views
  • 3 likes
  • 2 in conversation