So if you have this string
GLOBAL _OROPTMODEL_ STATUS=OK ALGORITHM=IP SOLUTION_STATUS=OPTIMAL OBJECTIVE=4482560894.6 PRIMAL_INFEASIBILITY=2.495295E-16
DUAL_INFEASIBILITY=9.21096E-19 BOUND_INFEASIBILITY=0 DUALITY_GAP=1.252394E-11 COMPLEMENTARITY=0 ITERATIONS=10 PRESOLVE_TIME=0.00
SOLUTION_TIME=0.02
It looks like is a series of name=value pairs delimited by spaces.
%let string=
GLOBAL _OROPTMODEL_ STATUS=OK ALGORITHM=IP SOLUTION_STATUS=OPTIMAL OBJECTIVE=4482560894.6 PRIMAL_INFEASIBILITY=2.495295E-16
DUAL_INFEASIBILITY=9.21096E-19 BOUND_INFEASIBILITY=0 DUALITY_GAP=1.252394E-11 COMPLEMENTARITY=0 ITERATIONS=10 PRESOLVE_TIME=0.00
SOLUTION_TIME=0.02
;
data want;
length index 8 name $32 value $32;
length string $32767 ;
string=symget('string');
do index=1 to countw(string,' ');
name = scan(scan(string,index,' '),1,'=');
value = scan(scan(string,index,' '),2,'=');
output;
end;
drop string;
run;
Result:
Obs index name value
1 1 GLOBAL
2 2 _OROPTMODEL_
3 3 STATUS OK
4 4 ALGORITHM IP
5 5 SOLUTION_STATUS OPTIMAL
6 6 OBJECTIVE 4482560894.6
7 7 PRIMAL_INFEASIBILITY 2.495295E-16
8 8 DUAL_INFEASIBILITY 9.21096E-19
9 9 BOUND_INFEASIBILITY 0
10 10 DUALITY_GAP 1.252394E-11
11 11 COMPLEMENTARITY 0
12 12 ITERATIONS 10
13 13 PRESOLVE_TIME 0.00
14 14 SOLUTION_TIME 0.02
Looks like the beginning of the string does not follow the rules of the rest of the string.
... View more