DATA Step, Macro, Functions and more

Not a SAS programmer but wants to code the following

Reply
New User S_B
New User
Posts: 1

Not a SAS programmer but wants to code the following

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.

Super User
Super User
Posts: 7,942

Re: Not a SAS programmer but wants to code the following

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.

Super User
Posts: 5,424

Re: Not a SAS programmer but wants to code the following

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".

Data never sleeps
Super User
Posts: 7,763

Re: Not a SAS programmer but wants to code the following

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)

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 3 replies
  • 171 views
  • 0 likes
  • 4 in conversation