Skip to content

Instantly share code, notes, and snippets.

@paulhomes
Created January 11, 2023 04:53
Show Gist options
  • Save paulhomes/029f77032e809e2a1d8ee7a13fc52c14 to your computer and use it in GitHub Desktop.
Save paulhomes/029f77032e809e2a1d8ee7a13fc52c14 to your computer and use it in GitHub Desktop.
A variation on the SAS PROC IOMOPERATE sample by Chris Hemedinger at https://blogs.sas.com/content/sasdummy/2016/02/15/using-proc-iomoperate/ to add an ALLCLIENTS table.
* Adapted from the SAS PROC IOMOPERATE sample by Chris Hemedinger
at https://blogs.sas.com/content/sasdummy/2016/02/15/using-proc-iomoperate/
to add an ALLCLIENTS table
;
%let connection='iom://mysasserver.example.com:8581;bridge;user=sasadm@saspw,pass=secretpassword';
* Get a list of processes;
proc iomoperate uri=&connection;
list spawned out=spawned;
quit;
* Use DOSUBL to submit a PROC IOMOPERATE step for
each SAS process to get details
Then use PROC TRANSPOSE to get a row-wise version
;
data _null_;
set spawned;
length y $ 3;
y = put(_n_,z3.);
x = dosubl("
proc iomoperate uri=&connection launched='" || serverid || "';
list attrs cat='Information' out=pids" || y || ";
list clients out=clients" || y || ";
quit;
data pids" || y || ";
set pids" || y || ";
length sname $30;
sname = substr(name,find(name,'.')+1);
run;
proc transpose data=work.pids" || y || "
out=work.tpids" || y || "
;
id sname;
var value;
run;
");
run;
* Append all transposed details together;
data allpids;
set tpids:;
length StartTime 8;
format StartTime datetime20.;
starttime = input(UpTime,anydtdtm19.);
run;
data allclients;
length client peer $200;
set clients:;
run;
* Clean up;
proc datasets lib=work nolist;
delete pids:;
delete tpids:;
delete clients:;
delete spawned;
quit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment