Hi ,I want Worked_Date should fall Between Start_date and End_Dae in new column
| Worked_Date | Start_Date | End_Date |
| 27/04/2016 | 5/25/2016 | 5/25/2016 |
| 1/6/2016 | 5/26/2016 | 5/27/2016 |
| 1/7/2016 | 5/28/2016 | 5/29/2016 |
| 1/8/2016 | 5/30/2016 | 5/31/2016 |
| 1/9/2016 | 5/31/2016 | 6/1/2016 |
| 1/10/2016 | 6/1/2016 | 6/5/2016 |
| 1/11/2016 | 6/2/2016 | 6/6/2016 |
| 1/12/2016 | 6/6/2016 | 6/7/2016 |
| 2/5/2016 | 6/7/2016 | 6/8/2016 |
| 2/6/2016 | 6/8/2016 | 6/9/2016 |
Post test data in the form of a datastep!!!
As such this is just assuming that those are dates:
data want; set have; indicator=ifn(start_date <= worked_date <= end_date,1,0); run;
I dont understand this question. In none of your records do Worked_Date fall between Start_Date and End_Date? What do you want the new column to contain?
sorrry for the miscommunication, kind ignore the previous table.
Hi i have (Project) start_date and End_Date and Worked_Date and i want to create indicateor for Worked_Date weather correctly falling between Start_Date and End_Date .
| Project | StartDate | EndDate | Worked_Date |
| 1 | 5/25/2016 | 4/9/2017 | 1/1/2017 |
| 2 | 4/10/2017 | 12/31/2199 | 2/7/2017 |
| 3 | 5/25/2016 | 12/31/2199 | 3/9/2017 |
| 4 | 5/25/2016 | 12/31/2199 | 4/11/2017 |
| 5 | 5/25/2016 | 12/15/2016 | 12/10/2016 |
| 6 | 12/16/2016 | 12/31/2199 | 3/13/2017 |
| 7 | 5/25/2016 | 2/19/2017 | 1/12/2017 |
| 8 | 5/25/2016 | 12/31/2199 | 4/7/2017 |
Well, just see of if work date date falls between start and end dates, and assign a indicator value of the comparison result. What part is it you don't know how to do? What have you tried so far?
Post test data in the form of a datastep!!!
As such this is just assuming that those are dates:
data want; set have; indicator=ifn(start_date <= worked_date <= end_date,1,0); run;
Thanks for the answer RW9.
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.