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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: