As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Tips:Get Process ID (PID) of SAS Tasks Running on Unix and Linux

From sasCommunity
Revision as of 12:36, 15 November 2008 by MMMMIIIIKKKKEEEE (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Did you know that you can use &SYSJOBID to get the Process ID (PID) of SAS tasks running on UNIX and Linux servers?


Sometimes I do this so that I can correlate the PID of a particular SAS batch task with UNIX/Linux system performance information.


Here is the code that I use, ripped from the heart of one of my SAS/Connect programs:


data _null_;

pid = &SYSJOBID;

put '************************************************************************'; put '* Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*'; put '* *'; put '* Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*'; put '* *'; put '* Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*'; put '* *'; put '************************************************************************'; put '_';

run;

This code produced the following, just now, when running SAS/Connect on a Linux server:


1 data _null_; 2 3 pid = &SYSJOBID; 4 5 put '************************************************************************'; 6 put '* Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*'; 7 put '* *'; 8 put '* Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*'; 9 put '* *'; 10 put '* Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*'; 11 put '* *'; 12 put '************************************************************************'; 13 put '_'; 14 15 run;

  • Attention: The Process ID (PID) of this SAS/Unix Session is: 31037 *
  • *
  • Attention: The Process ID (PID) of this SAS/Unix Session is: 31037 *
  • *
  • Attention: The Process ID (PID) of this SAS/Unix Session is: 31037 *
  • *

_ NOTE: DATA statement used (Total process time):

     real time           0.00 seconds
     cpu time            0.00 seconds


Kinda cool, eh?!?!?!?


Best of luck to you in all of your SAS endeavors!

Submitted by Michael A. Raithel. Contact me at my Discussion Page.