Hi all,
I am using SAS Enterprise Guide to execute Python code. We have SAS 9.4M6. I have used below ways but are unsuccessful. Could you please help me with it?
Python Code:
1:
proc fcmp;
declare object py(python);
rc = py.infile("/path/get_d_list.py");
put rc=;
rc = py.publish();
rc = py.call("isWritable", "/path/vyashoda");
/* Result = py.results["MyOutputKey"];*/
/* put Result=;*/
run;
2:
x "python3 /path/get_d_list.py";
3:
data _null_;
call system ('python3 /path/get_d_list.py');
run;
4:
%macro pwdls;
%sysexec %str(pwd;python3 /path/get_d_list.py);
%mend pwdls;
%pwdls;
I never used python in SAS, but you should use
filename CMD pipe 'python3 /path/get_d_list.py 2>&1';
data _null_;
infile CMD;
input;
put _infile_;
run;
instead of
data _null_;
call system ('python3 /path/get_d_list.py');
run;
to see OS messages.
I never used python in SAS, but you should use
filename CMD pipe 'python3 /path/get_d_list.py 2>&1';
data _null_;
infile CMD;
input;
put _infile_;
run;
instead of
data _null_;
call system ('python3 /path/get_d_list.py');
run;
to see OS messages.
Thanks much Chris for your help. Appreciate it. It's working for me.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.