BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
atux
Calcite | Level 5

I am trying to execute a python script in SAS using the systask command. I am using the systask over the x command so I can get the error return code when there is a problem. I am able to get the desired results when I run the following in a command prompt:

d:temp\python\getdata.py -c 9999 -l 000 -start 11/01/2020 -base 9999-000. 

 

When I run the following in enterprise guide I get an error code of 1 and the python command does not execute:

systask command "d:\temp\python\getdata.py. -c 9999. -l  &location. -start &startdate. -base 9999-000"
wait
status=RC_getdataCSV
shell;

 

data _null_;
if &RC_getdataCSV>0 or &sysrc>0 then do;
put 'ERROR Occurred Pulling data';
end;
else put 'NOTE: Run completed successfully';
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Use PIPE.  You might not get an error code, but you can read the messages that the command sends to the console.

data _null_;
  infile "d:\temp\python\getdata.py. -c 9999. -l  &location. -start &startdate. -base 9999-000 2>&1" pipe ;
  input;
  put _infile_;
run;

PS Do you really have a filename with two periods in it?  getdata.py. ? 

View solution in original post

2 REPLIES 2
Reeza
Super User
Is EG running locally to have the same access to the D drive? Or is it running on a server somewhere that D access may not be available?
Tom
Super User Tom
Super User

Use PIPE.  You might not get an error code, but you can read the messages that the command sends to the console.

data _null_;
  infile "d:\temp\python\getdata.py. -c 9999. -l  &location. -start &startdate. -base 9999-000 2>&1" pipe ;
  input;
  put _infile_;
run;

PS Do you really have a filename with two periods in it?  getdata.py. ? 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 1075 views
  • 0 likes
  • 3 in conversation