Trying to create the table below, i.e. adding another condition in the codes where if there is same Event_date then only Count_done as 1.
PROC SQL;
Create Table want1 as select
want.*, source.result_date,
case
when standard_days ge result_date and Event_date le result_date then '1'
else '0'
end
as Count_done
from want left join source on want.ID = source.ID;
Quit;
Current code produces this:
| ID | Event_date | Count_done |
| 123456 | 17/07/2018 | 1 |
| 123456 | 17/07/2018 | 1 |
| 234567 | 12/07/2018 | 1 |
This is what I want:
| ID | Event_date | Count_done |
| 123456 | 17/07/2018 | 1 |
| 123456 | 17/07/2018 | 0 |
| 234567 | 12/07/2018 | 1 |
Thanks in advance
Why would you want to do that in SQL?
data want;
set have;
by id event_date;
count_done = first.event_date;
run;
You are not showing all the fields you process.
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.