Hi,
I read from websites that having "2>Nul" in the end of cmd statement will route stderr output in windows. This works for me in below statement.
filename dirinfo pipe 'dir &path 2> Nul';
But it does not work in SCL system function with xcopy cmd statement. For eg. rc=system('xcopy <filename> <target folder> 2> Nul');
After I added 2>Nul in the end of the statement, return code rc is 4 and copy is not happening (usually on successful copy rc was 0).
Do you have any suggesstion to route stderr output from cmd statements in system function?
Thanks in advance!
-Sudharsanan
AF/SCL is behaving different I some aspects. It will build a buffer that is processed by Scl before it is given to the sas-processor.
You did not post your excact coding. When your are using SAS(R) Component Language 9.4: Reference, Second Edition (scl function) .
xcopy itself should work as you described. Sure the statement that is generated is correct? No other changes?
Thanks for your reply.
I have not done any other change than adding "2>nul" to the end of of the xcopy statement.
The code I had was working rc=system('xcopy <filename> <target folder> '); by copying files and rc=0.
When I changed it as rc=system('xcopy <filename> <target folder> 2>nul '); it was not working and rc=4.
Well <filename> and <target folder> are for sure not the real values, something is changing that.
If that something is doing a parse and change the < > characters than that something can also change your 2> null.
Hi Karman,
Thanks.
I have variable for <filename> and <target folder>. They have quotes and it was working without "2>nul" added in the end of the statment.
I have tested in many different cmd statement that having "2>nul" in SCL System function does not work.
The same issue happens in SAS/Base System function also.
For me "2>nul" works only in pipe statement with dir cmd command.
Please let me know if any suggestion.
For the SAS/Base language I know the issues well with all quutin issues
SAS(R) 9.4 Macro Language: Reference See the different meanings of special chars. Al lot of work when they are involved and needing bypasses. The difference between single and double quotes for strings can be very important. There is somewhere interference of symbols
You did not show the command (put statement) in full glory or other debugging action.
The usage of this as SCL function or as modified (submit block) SAS-base processing I am also not seeing...
The SAS-base is probably easier to debug focus on the quoting remarks.
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.