SAS Converting string values into numeric values

proc contents data=xxx1 position;
ods output position=kuekawa1;
run;

data kuekawa2;
set kuekawa1;
if type="Char" then do;
x1=compress(variable||"_n=input(");
x2=x1||variable||",7.);";
syntax=compress(x2);
*&var1._n=input(&var1,7.);
end;
if syntax ne "";
keep syntax;
run;

data _null_;set kuekawa2;
blank=' ';
file "C:\temp\proc_contents1.txt";
put
(syntax) (100.0);
run;

data xxx2;
set xxx1;
%include "C:\temp\proc_contents1.txt";
run;

Leave a Reply