BookmarkSubscribeRSS Feed
thanikondharish
Calcite | Level 5
data employee_work_duration;
INFILE CARDS MISSOVER ;
input empid department $ work_start:date9. work_end:date9. ;
format work_start work_end date9. ;
cards;
101 A 01JAN2023 03JAN2023
101 A 03JAN2023
101 A 03JAN2023
101 A 04JAN2023 06JAN2023
101 A 05JAN2023
101 A 06JAN2023
101 A 07JAN2023 14JAN2023
101 A 10JAN2023
101 B 01FEB2023 03FEB2023
101 B 03FEB2023
101 B 03FEB2023
101 B 04FEB2023 06FEB2023
101 B 05FEB2023
101 B 06FEB2023
101 B 07FEB2023 14FEB2023
101 B 10FEB2023 18FEB2023
RUN;
/*QUERY*/
Assign flags for wrong entry records
For example:
1) Don't start next record without ending previous record with in same department (for example: see record number 2,3)
2) Don't get repeated date/with in the range date record . For example see record number 15 and 16 . Here 16th record date is '10FEB2023' this date is equal to with in range of 15th record '07FEB2023'/'14FEB2023'
/**Final Output**/
empid department work_start work_end WRONG_ENTRY
101 A 01JAN2023 03JAN2023
101 A 03JAN2023 Y
101 A 03JAN2023 Y
101 A 04JAN2023 06JAN2023
101 A 05JAN2023 Y
101 A 06JAN2023 Y
101 A 07JAN2023 14JAN2023
101 A 10JAN2023
101 B 01FEB2023 03FEB2023
101 B 03FEB2023 Y
101 B 03FEB2023 Y
101 B 04FEB2023 06FEB2023
101 B 05FEB2023 Y
101 B 06FEB2023 Y
101 B 07FEB2023 14FEB2023
101 B 10FEB2023 18FEB2023 Y
 
 
 

Please help me out
1 REPLY 1
tomvincent
Fluorite | Level 6
What have you tried so far?

sas-innovate-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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
  • 1 reply
  • 216 views
  • 0 likes
  • 2 in conversation