BookmarkSubscribeRSS Feed
SrikanthY
Calcite | Level 5

retain the date1 value for the same subject and compare with date2. and for vistis also..

condition1 if dates are matching and visits are not matching then visit missmatch.

condition2 if visits are matching and dates are not matching then date missmatch.

condition3 if single subject then flag as present in date1 or date2 vice versa.

condition 4: for multiple rows (ex:A1017, A1029) should compare only if dates or visits are matching other wise apply condition3.

 

Input dataset

SubIDDate1Visit1Visit2Date2
A10034-Sep-17week 45  
A1003  Unscheduled4-Sep-17
A1005  Week 653-Apr-17
A1006  Early Discontinuation20-Oct-17
A100928-Aug-17Discont  
A1009  Visit 20 or Early Withdrawal28-Aug-17
A1009  Unscheduled28-Aug-17
A1011  Discont25-Oct-17
A1011  Week 788-Jun-17
A101721-Aug-17Discont  
A1017  Unscheduled21-Aug-17
A1017  Week 6511-Oct-17
A1020  Week 455-Apr-17
A10206-Apr-17Week 45  
A102112-Oct-17Unscheduled  
A1021  Week 2412-Oct-17
A10215-Oct-17Week 24  
A1025  Week 720-Oct-17
A1029  Unscheduled29-Apr-16
A1029  Unscheduled7-Dec-15
A102929-Apr-16Week 13  

 

output dataset

SubIDDate1Visit1Visit2Date2date_missmatchVisit_missmatchabsent in date1absent in date2
A10034-Sep-17week 45Unscheduled4-Sep-17 yes  
A1005  Week 653-Apr-17  yes 
A1006  Early Discontinuation20-Oct-17  yes 
A100928-Aug-17DiscontWeek 1028-Aug-17 yes  
A100928-Aug-17DiscontUnscheduled28-Aug-17 yes  
A1011  Discont25-Oct-17  yes 
A1011  Week 788-Jun-17  yes 
A101721-Aug-17DiscontUnscheduled21-Aug-17 yes  
A1017  Week 6511-Oct-17  yes 
A10206-Apr-17Week 45Week 455-Apr-17yes   
A102112-Oct-17UnscheduledWeek 2412-Oct-17 yes  
A10215-Oct-17Week 24Week 2412-Oct-17yes   
A1025Week 720-Oct-17     yes
A102929-Apr-16Week 13Unscheduled29-Apr-16 yes  
A1029  Unscheduled7-Dec-15  yes 
3 REPLIES 3
SrikanthY
Calcite | Level 5
Please check the required output. from the provided input data.

want to flag inconstant dates and visits.
Patrick
Opal | Level 21

@SrikanthY

1. Post your input data via a valid SAS data step creating a SAS table

2. Please don't expect people to do all the work for you. What have you done so far? Eventually post your not yet fully working code and some explanation of your approach.

sas-innovate-2024.png

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.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 725 views
  • 0 likes
  • 3 in conversation