Good day my friends:
I'm begining to work with dates, and i can't solve this simple problem:
This store has the record of payment of its workers like this:
Worker | Date |
1 | 09/20/1998 |
2 | 09/26/1998 |
3 | 09/27/1998 |
1 | 10/20/1998 |
2 | 10/26/1998 |
3 | 10/27/1998 |
1 | 11/21/1998 |
2 | 11/26/1998 |
3 | 11/27/1998 |
1 | 12/21/1998 |
2 | 12/27/1998 |
3 | 12/28/1998 |
1 | 01/22/1999 |
3 | 01/28/1999 |
3 | 02/28/1999 |
3 | 03/28/1999 |
3 | 04/28/1999 |
3 | 05/28/1999 |
3 | 06/28/1999 |
3 | 07/28/1999 |
3 | 08/28/1999 |
So, what is needed is: first group by workers, into workers is needed order the dats from older to newer, and add a colum indicating the number of payment, manually could be done and obtain this:
Order | Worker | Date |
1 | 1 | 09/20/1998 |
2 | 1 | 10/20/1998 |
3 | 1 | 11/21/1998 |
4 | 1 | 12/21/1998 |
5 | 1 | 01/22/1999 |
1 | 2 | 09/26/1998 |
2 | 2 | 10/26/1998 |
3 | 2 | 11/26/1998 |
4 | 2 | 12/27/1998 |
1 | 3 | 09/27/1998 |
2 | 3 | 10/27/1998 |
3 | 3 | 11/27/1998 |
4 | 3 | 12/28/1998 |
5 | 3 | 01/28/1999 |
6 | 3 | 02/28/1999 |
7 | 3 | 03/28/1999 |
8 | 3 | 04/28/1999 |
9 | 3 | 05/28/1999 |
10 | 3 | 06/28/1999 |
11 | 3 | 07/28/1999 |
12 | 3 | 08/28/1999 |
how can i do to make this using SAS??
Thank you very much
You can try the below code
Proc SQL;
Select Sum (Worker) as Order, Worker, Date from Table1
Group by Worker, date
Order by Worker, date;
Quit;
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.