I am writing a genetic algorithm implementation from python and I need to call some sas procedures inside the ObjectFunction that i am defining. For example when i try to use
proc compare base=selected_row compare=evolving_individual outstats=compare_result noprint;
run;
inside my objective function i get an error saying
It's true that you can't execute SAS procedures directly from within your PROC GA objective function. The key is to create a macro that calls the procedures you wish to execute. Then, in your objective function definition you can call the macro with the 'run_macro' function.
The following SGF paper from 2013 demonstrates how to use run_macro from within a function definition:https://support.sas.com/resources/papers/proceedings13/033-2013.pdf
It's true that you can't execute SAS procedures directly from within your PROC GA objective function. The key is to create a macro that calls the procedures you wish to execute. Then, in your objective function definition you can call the macro with the 'run_macro' function.
The following SGF paper from 2013 demonstrates how to use run_macro from within a function definition:https://support.sas.com/resources/papers/proceedings13/033-2013.pdf
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.