The _OROPTMILP_ macro variable contains this information. You can use the following DATA step to append the desired values to a text file:
data _null_;
file 'myfile.txt' mod;
oroptmilp = symget('_OROPTMILP_');
index = index(oroptmilp, 'OBJECTIVE');
objective = scan(substr(oroptmilp, index), 2, ' =');
index = index(oroptmilp, 'RELATIVE_GAP');
relative_gap = scan(substr(oroptmilp, index), 2, ' =');
put objective relative_gap;
run;
By the way, in PROC OPTMODEL these values are more simply accessible as
_OROPTMODEL_NUM_['OBJECTIVE'] and _OROPTMODEL_NUM_['RELATIVE_GAP'].