05-09-2016 04:35 AM
Is there any way in sas to obtain Shell output inside SAS. For example, I am trying to obtain the output of Unix Shell command "top" (which is in the attached). Is there any way to do it in SAS ? I have seen command line calls can be executed using the sas functions like "System()" or "X". But the Question is to get the output inside SAS along with the executon.
Thanks and regards
05-09-2016 04:39 AM
Set your OS command as a filename, then datastep read it in, in this example I use the Windows, and below I make an attempt to show the top even though I don't use Unix:
filename mytmp pipe 'dir "c:\temp" /b'; data dir_list; length buffer $200; infile mytmp dlm="¬"; input buffer; run;
filename mytmp pipe 'top';
05-09-2016 05:34 AM
You could try the mem command:
You may be better off getting some system monitor sotware though, more functionality/control.
05-09-2016 04:53 AM
Another way is to redirect the output of Shell Command into a file :
$ls *.csv > /home/etc/output.txt
and then import it into SAS:
filename x '/home/etc/output.txt';
05-09-2016 05:42 AM
I can't test it . so I can't say YES.
My thought is setting up a schedule task , launch it at every hour or half-hour, and run the SAS script we just suggested.
05-09-2016 08:30 AM
Not sure how you wish to do that? In the same SAS session? Don't think that's possible, and why?
SAS interacts/uses system resources so monitoring should take place outside SAS.
For statistical purposes, you could use SAS to collect the figures, like options fullstimer, or ARM stuff.