11-17-2011 11:39 AM
Can anybody tell me why this works:
x dir p:\sas\data\*.txt > p:\sas\data\test.txt ;
but this doesn't:
x ping www.google.ca > p:\sas\data\pingtest.txt ;
I have OPTION XWAIT so I need to close the X window when it opens in the first example, but in the second example, the window opens and closes right away - tooo fast to see any messages or errors (if any).
I can enter the command from a CMD window and it works.
Thanks in advance.
11-17-2011 12:36 PM
Good question! I don't know why it doesn't work, but I can offer a work-around. It worked for me when I submitted the command using a pipe. What I ran was:
Filename pinginf pipe "ping www.google.ca" ;
Filename pingout "c:\art\pingout.txt";
infile pinginf pad ;
input dsn $50. ;
11-17-2011 12:40 PM
(How's it goin', eh?)
I tried the pipe, and I also got it to work by using the X command to run a .BAT file that contains the PING command.
Really odd that it won't run the PING from the X command itself. Wonder if anyone from SAS knows whats up?
11-17-2011 03:02 PM
Joe Matise, over on SAS-L, suggested an interest combination of quotes that worked:
x '"ping www.google.ca" > c:\ping2.txt';
Let me know if that works for you.
Otherwise, the > symbol is apparently being considered a parameter rather than an argument. Also, having to specify it this way won't accept rerouted aliases. Thus, in the US, www.google.ca won't work using this method.
11-17-2011 03:38 PM
and, from SAS-L as well, Bolotin Yevgeniy offered a solution that is less finicky:
x "cmd /c ping www.google.ca > c:\pipe3.txt";
Of course, he also stated that with this method if you are not on windows, you would have to use the appropriate shell commands for your OS
11-17-2011 10:56 PM
Nice find! Doesn't explain it, though, other than SAS has known about it since 2003.
How did you find the note? After seeing your post I did a google search for:
"note" "PING command might not work" site:support.sas.com
with the result:
No results found for "note" "PING command might not work" site:support.sas.com.
Need further help from the community? Please ask a new question.