data have;
infile cards truncover;
input Chat_id Chattext $200.;
cards;
101 10/05/2024 10:15:00 krishna.vangalli@gmail.com hello Raju how are you 10/05/2024 10:16:15 Raju@gmail.com Hey krishna whatsup I'm doing good
102 10/06/2024 11:15:00 krish.vangalli@gmail.com hello 10/06/2024 10:16:15 Raju@gmail.com Hey krishna whatsup I'm doing good
;
data want;
set have;
pid=prxparse('/\d+\/\d+\/\d+/');
s=1;e=length(Chattext);
call prxnext(pid,s,e,Chattext,p,l);
do while(p>0);
_p=p;
call prxnext(pid,s,e,Chattext,p,l);
if p>0 then temp=substr(Chattext,_p,p-_p);
else temp=substr(Chattext,_p);
date=scan(temp,1,,'s');
time=scan(temp,2,,'s');
sender=scan(temp,3,,'s');
call scan(temp,3,p2,l2,,'s');
chat_text=substr(temp,p2+l2);
output;
end;
keep Chat_id date time sender chat_text ;
run;