data _null_;
set xxx end = eof;
if _n_ = 1 then
call execute('data new; set xxx;');
call execute('if formula = "' || formula ||'" then value = ' ||formula || ';');
if eof then call execute('run;');
run;
This will be slow and it doesn't handle nested functions.
[pre]
data results;
input formula $40.;
value = input(resolve(cats('%sysfunc(',formula,')')),f8.);
cards;
netpv(0.1, 1,0, 1000)
sin(45)
netpv(0.1,1,0,2000)
;;;;
run;
proc print;
run;
[/pre]
The 2025 SAS Hackathon Kicks Off on June 11!
Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.