I am not a SAS programmer but more behind the scences (admin). I am looking to code the following : in Base SAS 9.4 or Enterprise Guide 6.1.
I have 3 seperate Unix servers that I want to connect to and run the following command df -h
Then generate those results and export to a excel spreadsheet.
I have the following to work with:
---Base SAS Software
---SAS/STAT
---SAS/GRAPH
---SAS/ETS
---SAS/FSP
---SAS/OR
---SAS/AF
---SAS/IML
---SAS/ASSIST
---SAS/CONNECT
---SAS/EIS
---MDDB Server common products
---SAS/Secure 168-bit
---SAS/Secure Windows
---SAS Enterprise Guide
---OR OPT
---OR PRS
---OR IVS
---OR LSO
---SAS/ACCESS Interface to Oracle
---SAS/ACCESS Interface to PC Files
---SAS/ACCESS Interface to ODBC
---SAS/IML Studio
---SAS Workspace Server for Local Access
---High Performance Suite
Any help is greatly appreciated.
Why do you not just run that command and stream the output to a CSV file? Am sure it can be done, in DOS its just:
dir c:\temp -> results.txt
Your an admin, so you should have the tools for this?
It can get a bit more complicated is you want to do it in SAS.
If you are on Linux, I'm pretty sure that are some free/share ware tools that helps do basic resource reporting.
This is might out of the scope for this thread, but I can't help seeing that your SAS product portfolio is a bit outdated. If trade in some of the V8 products (MDDB Server, EIS, ASSIST, FSP, AF and potentially CONNECT) so you could use the V9 SAS Intelligence Platform. That would include the SAS Environment Manager, that lets you do extensive reporting on both SAS specific, and some OS specific resources "out of the box".
A simple SAS program to read the output of the df command into a SAS file looks like that:
filename oscmd pipe "df -k";
data diskfree;
infile oscmd dlm=" " truncover firstobs=2;
length
volume $30
space 8
used 8
nodes 8
directory $100
;
informat
percent
npercent
percent5.
;
format
percent
npercent
percent5.
space
used
comma12.
nodes comma9.
;
input
volume@
;
if volume ne '/proc';
input
space
used
percent
nodes
npercent
directory
;
run;
Note that I use -k instead of the -h option, as it spares me the hassle of interpreting the K, M, or G.
Also note the subsetting if that suppresses the /proc filesystem, as it does not contain valid numerical values (AIX)
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.