BookmarkSubscribeRSS Feed
FK1
Lapis Lazuli | Level 10 FK1
Lapis Lazuli | Level 10

Hi There,

 

I do have a perfectly fine working shell command:

 

 

ssh johndoe@some.server.com > /home/some/path/test42.txt  mysql -u johnny -psomeawkwardpassword > /home/some/path/test42.txt <<< "select * from information_schema.TABLES WHERE table_schema = 'some_value' "

 

When running in a shell, I get the executed query results written to the text file "test42.txt"

 

However, when I try to execute this shell command from within SAS-EG I get a &sysrc=2 !

(Unfortunately, the SAS log does not include error messages from the operating system (or any output done to stdout and stderr) during execution of the shell command)

 

In the SAS-Log, however, I do not get any kind of error or warning whatsoever!

 

I am using %sysexec:

 

%sysexec  
%unquote(%nrbquote(
ssh johndoe@some.server.com
mysql -u johnny -psomeawkwardpassword > /home/some/path/test42.txt
<<< "select * from information_schema.TABLES WHERE table_schema = 'some_value' "))
;

 

 

What is the correct SAS-EG syntax?

3 REPLIES 3
lethcons
Obsidian | Level 7

I don't think this is a syntax error.

Check the value of the SAS option XCMD. If it is set to NOXCMD then you are prevented from issuing shell commands. You may be able to reset it to XCMD but your sys admin may have prevented this.

FK1
Lapis Lazuli | Level 10 FK1
Lapis Lazuli | Level 10

I checked it. It is turned on, i.e. I can send x commands from within SAS-EG:

 

cxmd-option.JPG

Astounding
PROC Star

A small step to try ... this particular command does not require %nrbquote.  Try getting rid of %unquote and %nrbquote and the two sets of parentheses and see if that improves the information you receive about where the problem lies.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 1510 views
  • 0 likes
  • 3 in conversation