i | holiday |
01/12/2018 | . |
02/12/2018 | 02/12/2018 |
03/12/2018 | . |
04/12/2018 | . |
05/12/2018 | . |
06/12/2018 | . |
07/12/2018 | . |
08/12/2018 | 08/12/2018 |
09/12/2018 | 09/12/2018 |
10/12/2018 | . |
11/12/2018 | . |
12/12/2018 | . |
13/12/2018 | . |
14/12/2018 | . |
15/12/2018 | 15/12/2018 |
16/12/2018 | 16/12/2018 |
17/12/2018 | . |
18/12/2018 | . |
19/12/2018 | . |
20/12/2018 | . |
21/12/2018 | . |
22/12/2018 | 22/12/2018 |
23/12/2018 | 23/12/2018 |
24/12/2018 | . |
25/12/2018 | . |
26/12/2018 | . |
27/12/2018 | . |
28/12/2018 | . |
29/12/2018 | . |
30/12/2018 | 30/12/2018 |
31/12/2018 | . |
I have above dataset I have one question i.e.,
every date must be added 3days continuously dates like (itself date date+2) (03dec2018) so in this case when you are adding if any holidays don't consider those dates like see below dataset
I have tried but but i coudn't . Please find this problem.
i | holiday | a |
01/12/2018 | . | 3 |
02/12/2018 | 02/12/2018 | 5 |
03/12/2018 | . | 5 |
04/12/2018 | . | 6 |
05/12/2018 | . | 7 |
06/12/2018 | . | 10 |
07/12/2018 | . | 11 |
08/12/2018 | 08/12/2018 | 12 |
09/12/2018 | 09/12/2018 | 12 |
10/12/2018 | . | 12 |
11/12/2018 | . | 13 |
12/12/2018 | . | 14 |
13/12/2018 | . | 17 |
14/12/2018 | . | 18 |
15/12/2018 | 15/12/2018 | 19 |
16/12/2018 | 16/12/2018 | 19 |
17/12/2018 | . | 19 |
18/12/2018 | . | 20 |
19/12/2018 | . | 21 |
20/12/2018 | . | 24 |
21/12/2018 | . | 25 |
22/12/2018 | 22/12/2018 | 26 |
23/12/2018 | 23/12/2018 | 26 |
24/12/2018 | . | 26 |
25/12/2018 | . | 27 |
26/12/2018 | . | 28 |
27/12/2018 | . | 29 |
28/12/2018 | . | . |
29/12/2018 | . | . |
30/12/2018 | 30/12/2018 | . |
31/12/2018 | . | . |
@thanikondharish wrote:
i
holiday
01/12/2018
.
02/12/2018
02/12/2018
03/12/2018
.
04/12/2018
.
05/12/2018
.
06/12/2018
.
07/12/2018
.
08/12/2018
08/12/2018
09/12/2018
09/12/2018
10/12/2018
.
11/12/2018
.
12/12/2018
.
13/12/2018
.
14/12/2018
.
15/12/2018
15/12/2018
16/12/2018
16/12/2018
17/12/2018
.
18/12/2018
.
19/12/2018
.
20/12/2018
.
21/12/2018
.
22/12/2018
22/12/2018
23/12/2018
23/12/2018
24/12/2018
.
25/12/2018
.
26/12/2018
.
27/12/2018
.
28/12/2018
.
29/12/2018
.
30/12/2018
30/12/2018
31/12/2018
.
I have above dataset I have one question i.e.,
every date must be added 3days continuously dates like (itself date date+2) (03dec2018) so in this case when you are adding if any holidays don't consider those dates like see below dataset
I have tried but but i coudn't . Please find this problem.
i
holiday
a
01/12/2018
.
3
02/12/2018
02/12/2018
5
03/12/2018
.
5
04/12/2018
.
6
05/12/2018
.
7
06/12/2018
.
10
07/12/2018
.
11
08/12/2018
08/12/2018
12
09/12/2018
09/12/2018
12
10/12/2018
.
12
11/12/2018
.
13
12/12/2018
.
14
13/12/2018
.
17
14/12/2018
.
18
15/12/2018
15/12/2018
19
16/12/2018
16/12/2018
19
17/12/2018
.
19
18/12/2018
.
20
19/12/2018
.
21
20/12/2018
.
24
21/12/2018
.
25
22/12/2018
22/12/2018
26
23/12/2018
23/12/2018
26
24/12/2018
.
26
25/12/2018
.
27
26/12/2018
.
28
27/12/2018
.
29
28/12/2018
.
.
29/12/2018
.
.
30/12/2018
30/12/2018
.
31/12/2018
.
.
Please post your data as a data step and include your attempts.
What is the rule
Apparently your goal is to generate the A values based on the current date and the status of holiday dates between the current date and the desired future data.
But I can't figure out what rule you have. Every rule I think of has an except in your data. Please explain mathematically.
I think you first record value of A is wrong.
This appears to be the rule:
If so, then:
data have;
input date :ddmmyy10. holiday :ddmmyy10. a;
format date holiday yymmddn8. ;
datalines;
01/12/2018 . 3
02/12/2018 02/12/2018 5
03/12/2018 . 5
04/12/2018 . 6
05/12/2018 . 7
06/12/2018 . 10
07/12/2018 . 11
08/12/2018 08/12/2018 12
09/12/2018 09/12/2018 12
10/12/2018 . 12
11/12/2018 . 13
12/12/2018 . 14
13/12/2018 . 17
14/12/2018 . 18
15/12/2018 15/12/2018 19
16/12/2018 16/12/2018 19
17/12/2018 . 19
18/12/2018 . 20
19/12/2018 . 21
20/12/2018 . 24
21/12/2018 . 25
22/12/2018 22/12/2018 26
23/12/2018 23/12/2018 26
24/12/2018 . 26
25/12/2018 . 27
26/12/2018 . 28
27/12/2018 . 29
28/12/2018 . .
29/12/2018 . .
30/12/2018 30/12/2018 .
31/12/2018 . .
run;
data want (drop=_:);
merge have
have (firstobs=3 keep=date holiday rename=date=date3) ;
where holiday =.;
day3=day(date3);
do until (_date=date);
set have (rename=date=_date);
output;
end;
run;
The strategy here is
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.