BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sivastat08
Pyrite | Level 9

Hi ,I want Worked_Date should fall Between Start_date and End_Dae in new column 

 

Worked_DateStart_DateEnd_Date
27/04/20165/25/20165/25/2016
1/6/20165/26/20165/27/2016
1/7/20165/28/20165/29/2016
1/8/20165/30/20165/31/2016
1/9/20165/31/20166/1/2016
1/10/20166/1/20166/5/2016
1/11/20166/2/20166/6/2016
1/12/20166/6/20166/7/2016
2/5/20166/7/20166/8/2016
2/6/20166/8/20166/9/2016
1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;

View solution in original post

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

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?

sivastat08
Pyrite | Level 9

 

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 .

 

 

ProjectStartDateEndDateWorked_Date
15/25/20164/9/20171/1/2017
24/10/201712/31/21992/7/2017
35/25/201612/31/21993/9/2017
45/25/201612/31/21994/11/2017
55/25/201612/15/201612/10/2016
612/16/201612/31/21993/13/2017
75/25/20162/19/20171/12/2017
85/25/201612/31/21994/7/2017
LinusH
Tourmaline | Level 20

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?

Data never sleeps
sivastat08
Pyrite | Level 9
Thanks for your motivation LinusH..going forward i will try to do.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;
sivastat08
Pyrite | Level 9

Thanks for the answer RW9.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1954 views
  • 4 likes
  • 4 in conversation