Hi all,
Does anyone know if there is somehow a way to read macro variable within proc fcmp or pass information to fcmp some other way e.g. using inlib?
I am hoping to do something similar to the the following:
%let sdk_location = "/sdk_home";
proc fcmp;
declare object py(python);
submit into py;
# Load SDK.
import sys
sys.path.insert(0, sdk_location + '/python3')
from sdk import *
...
...
...
run;
Best regards,
Olli
But you can always do this:
%let sdk_location = /sdk_home;
filename inc temp;
data _null_;
file inc;
put "proc fcmp;";
put "declare object py(python);";
put "submit into py;";
put "# Load SDK.";
put "import sys ";
put "sys.path.insert(0, '&sdk_location.' + '/python3')";
put "from sdk import *";
put "further code here";
put "run;";
run;
%inc inc;
filename inc clear;
Did you try this:
proc fcmp;
declare object py(python);
submit into py;
# Load SDK.
import sys
sys.path.insert(0, &sdk_location. + '/python3')
from sdk import *
...
...
...
run;
This is just a guess, to see if SAS resolves the macro variable before the code is handed over to Python.
But you can always do this:
%let sdk_location = /sdk_home;
filename inc temp;
data _null_;
file inc;
put "proc fcmp;";
put "declare object py(python);";
put "submit into py;";
put "# Load SDK.";
put "import sys ";
put "sys.path.insert(0, '&sdk_location.' + '/python3')";
put "from sdk import *";
put "further code here";
put "run;";
run;
%inc inc;
filename inc clear;
Thanks @Kurt_Bremser . Using the include worked perfectly.
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 use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.