Hi All,
I have a date variable from that I need to make 3 variables. like below.
Date |
26/03/2017 |
27/03/2017 |
28/03/2017 |
29/03/2017 |
30/03/2017 |
31/03/2017 |
01/04/2017 |
02/04/2017 |
03/04/2017 |
04/04/2017 |
05/04/2017 |
06/04/2017 |
07/04/2017 |
08/04/2017 |
09/04/2017 |
10/04/2017 |
11/04/2017 |
12/04/2017 |
13/04/2017 |
14/04/2017 |
15/04/2017
|
Week | Week Start | Week End |
1 | 26/03/2017 | 01/04/2017 |
2 | 02/04/2017 | 08/04/2017 |
Thanks,
SS.
Use the intnx function:
data test;
curr_date = input('26/03/2017',ddmmyy10.);
week_start = intnx('week',curr_date,0,'b');
week_end = intnx('week',curr_date,0,'e');
format curr_date week_start week_end ddmmyy10.;
run;
Use the intnx function:
data test;
curr_date = input('26/03/2017',ddmmyy10.);
week_start = intnx('week',curr_date,0,'b');
week_end = intnx('week',curr_date,0,'e');
format curr_date week_start week_end ddmmyy10.;
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.