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?
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.
I checked it. It is turned on, i.e. I can send x commands from within SAS-EG:
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.
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!
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.