Hallo,
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
Ehsan
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';
data ...
whats the equivalant to "top" in Windows (DOS) ?
I check again, my SAS is running on Windows.
You could try the mem command:
http://www.computerhope.com/memhlp.htm
You may be better off getting some system monitor sotware though, more functionality/control.
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';
data _null_;
infile x;
input;
put _infile_;
run;
Actually, I am thinking to monitor RAM and CPU Usage inside SAS during computation. Is it possible ?
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.
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.
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.