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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.