BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ojaro
SAS Employee

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

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

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;

View solution in original post

3 REPLIES 3
Kurt_Bremser
Super User

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.

Kurt_Bremser
Super User

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;
ojaro
SAS Employee

Thanks @Kurt_Bremser . Using the include worked perfectly.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 743 views
  • 1 like
  • 2 in conversation