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.


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

From sasCommunity
Jump to: navigation, search
(Get Process ID (PID) of SAS Tasks Running on Unix and Linus)
 
Line 15: Line 15:
  
 
put '************************************************************************';
 
put '************************************************************************';
 +
 
put '*  Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*';
 
put '*  Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*';
 +
 
put '*                                                                      *';
 
put '*                                                                      *';
 +
 
put '*  Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*';
 
put '*  Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*';
 +
 
put '*                                                                      *';
 
put '*                                                                      *';
 +
 
put '*  Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*';
 
put '*  Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*';
 +
 
put '*                                                                      *';
 
put '*                                                                      *';
 +
 
put '************************************************************************';
 
put '************************************************************************';
 +
 
put '_';
 
put '_';
  
Line 30: Line 38:
  
 
1    data _null_;
 
1    data _null_;
 +
 
2
 
2
 +
 
3    pid    = &SYSJOBID;
 
3    pid    = &SYSJOBID;
 +
 
4
 
4
 +
 
5    put '************************************************************************';
 
5    put '************************************************************************';
 +
 
6    put '*  Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*';
 
6    put '*  Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*';
 +
 
7    put '*                                                                      *';
 
7    put '*                                                                      *';
 +
 
8    put '*  Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*';
 
8    put '*  Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*';
 +
 
9    put '*                                                                      *';
 
9    put '*                                                                      *';
 +
 
10  put '*  Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*';
 
10  put '*  Attention: The Process ID (PID) of this SAS/Unix Session is: ' pid '*';
 +
 
11  put '*                                                                      *';
 
11  put '*                                                                      *';
 +
 
12  put '************************************************************************';
 
12  put '************************************************************************';
 +
 
13  put '_';
 
13  put '_';
 +
 
14
 
14
 +
 
15  run;
 
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 *
 
*  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):
 
NOTE: DATA statement used (Total process time):
 +
 
       real time          0.00 seconds
 
       real time          0.00 seconds
 +
 
       cpu time            0.00 seconds
 
       cpu time            0.00 seconds
  

Revision as of 12:38, 15 November 2008

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.