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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.