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
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.