home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / bit / listserv / sasl / 5533 < prev    next >
Encoding:
Text File  |  1993-01-06  |  3.0 KB  |  86 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!paladin.american.edu!auvm!SALT.RA.ANL.GOV!SPARAPAN
  3. Message-ID: <9301061845.AA16502@salt.ra.anl.gov>
  4. Newsgroups: bit.listserv.sas-l
  5. Date:         Wed, 6 Jan 1993 12:45:57 CST
  6. Reply-To:     RA Sparapani RA/208/xxx gwing <sparapan@SALT.RA.ANL.GOV>
  7. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  8. From:         RA Sparapani RA/208/xxx gwing <sparapan@SALT.RA.ANL.GOV>
  9. Subject:      SAS Program_Name in DATA _NULL_ Step Under SunOS
  10. Comments: To: sas-l@uga.cc.uga.edu
  11. Lines: 73
  12.  
  13. SAS-L:
  14.  
  15. There was a recent discussion on SAS-L with regard to recovering the
  16. name of the SAS program running within the program.  Here is an
  17. operating system dependent solution we have implemented in a DATA
  18. _NULL_ step.  The code is 22 lines long which may be longer than
  19. most people would like, but almost half the lines are dedicated to
  20. character input so if someone knew a more pleasing character
  21. solution the code could be cut down considerably.  The log file
  22. from a run follows.  The program name is "pid".
  23.  
  24. Rodney
  25.  
  26. NOTE: Copyright(c) 1989 by SAS Institute Inc., Cary, NC USA.
  27. NOTE: SAS (r) Proprietary Software Release 6.07  TS203
  28.  
  29. NOTE: SAS initialization used:
  30.       real time           1.279 seconds
  31.       cpu time            0.560 seconds
  32.  
  33. NOTE: Libname GDEVICE0 refers to the same physical library as SASUSER.
  34. NOTE: Libref GDEVICE0 was successfully assigned as follows:
  35.       Engine:        V607
  36.       Physical Name: /home/flash1/sparapan/sasuser
  37.  
  38. NOTE: AUTOEXEC processing completed.
  39.  
  40. 1          %global sys_sas;
  41. 2          %let columns=80;
  42. 3          filename pid pipe "ps | grep -e 'sas[ ]'";
  43. 4          data _null_;
  44. 5          format line $char&columns..;
  45. 6          infile pid missover;
  46. 7          do i=1 to &columns;
  47. 8               input @i char $char1. @;
  48. 9               if i=1 then line=char;
  49. 10              else line=char||line;
  50. 11              end;
  51. 12         line=reverse(trim(line));
  52. 13         put line;
  53. 14         if scan(line,1," ")=&sysjobid then do;
  54. 15              i=2;
  55. 16              do while(scan(line,i," ")^="sas");
  56. 17                      i=i+1;
  57. 18                      end;
  58. 19              call symput("sys_sas",scan(line,i+1," "));
  59. 20              end;
  60. 21         input;
  61. 22         run;
  62.  
  63. NOTE: The infile PID is:
  64.       Pipe command="ps | grep -e 'sas[ ]'"
  65.  
  66. 16355 p0 TW    0:01 sas -fsd ascii -nonews
  67. 16487 p0 S     0:00 sas pid -nonews
  68. NOTE: 2 records were read from the infile PID.
  69.       The minimum record length was 35.
  70.       The maximum record length was 42.
  71. NOTE: Character values have been converted to numeric values at the places given
  72.  by: (Number of times) at (Line):(Column).
  73.       2 at 14:4
  74. NOTE: DATA statement used:
  75.       real time           1.497 seconds
  76.       cpu time            0.270 seconds
  77.  
  78.  
  79. 23         %put &sys_sas;
  80. pid
  81. NOTE: The SAS System used:
  82.       real time           3.420 seconds
  83.       cpu time            1.060 seconds
  84.  
  85. NOTE: SAS Institute Inc., SAS Circle, PO Box 8000, Cary, NC 27512-8000
  86.