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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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