I am attempting to extract parts of a string with carriage returns based on a keyword in SAS eg.
Str="started manually 23:56:22
Skipped: obtain name
Completed: verify dob
Skipped: ask again
Skipped: verify address
Completed: verify country
Stopped manually 23:58:55"
I am trying to pull out parts of this based on Skipped
or Completed
.
So if i ask for Skipped i would want end result to be, including carriage return:
Obtain name
Ask again
Verify address
I am thinking I would need to loop to find each instance of skipped. I have tried different variations of SCAN,FIND,INDEX,SUBSTR.
I have extracted substring before but only when the string was consistent in character/word position. This string will very greatly. Any number of skipped or completed could be present with different start and end wording. I am working in SASeg.