Below some options:
data have;
infile datalines dsd;
input ID indi $50.;
/* simple way if you can be sure that there is only one number in the string */
want1=input(compress(indi,,'kd'),?? best32.);
/* option 2: use -AE as token */
want2=input(substr(indi,find(indi,'-AE','i')+3),?? best32.);
/* or with a RegEx if the pattern is a bit more complicated*/
retain _rxID;
if _n_=1 then _rxID=prxparse('/-AE(\d+)/oi');
if prxmatch(_rxID, indi) then
do;
want3=input(prxposn(_rxID, 1, indi),?? best32.);
end;
datalines;
1,Any EVENT, SPECIFY*-AE1
2,Among EVENT, SPECIFY*-AE2
2,Among EVENT, SPECIFY*-AE34and something else 77
;
run;