SAS: avoid printing log in RSUBMIT - TagMerge
4SAS: avoid printing log in RSUBMITSAS: avoid printing log in RSUBMIT

SAS: avoid printing log in RSUBMIT

Asked 5 months ago
0
4 answers

You could use option nonote; to turn off notes - that might not eliminate everything though. But it should help with some of it, at least. You might need it in both the main and the rsubmitted session.

Source: link

0

Check some of the the options on the SIGNON command for more control over the logging. https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.3/connref/p0brzkmxqg483hn163ek01h4mf6e.htm

There are options on the SIGNON command to direct where the LOG and OUTPUT is written when using NOSIGNONWAIT option.

LOG=KEEP | PURGE | file-specification OUTPUT=KEEP | PURGE | file-specification Used only when NOSIGNONWAIT is in effect, these options direct the SAS log or the SAS output that is generated by the current server session to the backing store or to a file specification. A backing store is a SAS utility file that is written to disk in the client SAS Work library.

There are options on the SIGNON command to control whether to use Synchronous and Asynchronous SIGNONs. With Asynchronous you can use RGET to time when to retrieve the log.

Difference between Synchronous and Asynchronous SIGNONs A sign-on is executed either synchronously or asynchronously.

synchronous Client session control is not regained until after the sign-on has completed. Synchronous processing is the default processing mode.

asynchronous Client session control is regained immediately after the client issues the SIGNON statement. Subsequent programs can execute in the client session and in the server sessions while a sign-on is in progress.

Synchronous sign-ons display results and output in the client session. If the SIGNON is asynchronous, you can use the RGET and RDISPLAY commands and statements and the LOG= and OUTPUT= options to retrieve and view the results.

Source: link

0

Examples:
authdomain=DefaultAuth
authdomain="SAS/CONNECT Auth Domain"
1  rsubmit emp1 sascmd="!sascmd";
2  %let sashost=hrmach1.dorg.com;
   rsubmit sashost;
3  %let sashost=hrmach1.dorg.com;
   rsubmit sashost.sasport;
4  rsubmit hrmach1.2267;

Source: link

0

This macro sets up a dataset, to contain jobs that will be processed by the remote sessions. A space-separated list of variables is passed in, the values of these will be set for each job when the job is added to the queue.
%Macro initialiseJobQueue(vars=);
  Proc DataSets Lib=Work noDetails noList;
    Delete _jobQueue;
  Quit;

  Data _jobQueue;
    Format code
    %Do iVar = 1 %to %sysFunc(countW(&vars.));
      %scan(&vars., &iVar.)
    %End;
    $256.;

    *need to initialise to avoid error...;
    code = "";
    %Do iVar = 1 %to %sysFunc(countW(&vars.));
      %scan(&vars., &iVar.) = "";
    %End;

    *...but delete the blank row;
    Delete;
  Run;
%MEnd initialiseJobQueue;
This macro specifies the code file to run for the job and adds the values for the variables defined during %initialiseJobQueue. You’ll need to make sure the values provided are in the same order that the variables were defined.
%Macro addToJobQueue(code=, values=);
Let valuesList = "&code.", ;
%Do iValue = 1 %to %sysFunc(countW(&values.));
  %If %eval(&iValue. < %sysFunc(countW(&values.))) %then %do;
    %Let valuesList = &valuesList. "%scan(&values., &iValue.)",;
  %End;
  %Else %do;
    %Let valuesList = &valuesList. "%scan(&values., &iValue.)";
  %End;
%End;

%Put &valuesList.;
Proc SQL;
  Insert into _jobQueue
  Values (&valuesList);
Quit;
%MEnd addToJobQueue;
The number of sessions is managed by counting the &cMacVar. variables that equal 2; a value of 2 means the related session is running. As soon as the number of remote sessions reaches the upper limit, the spawning session will wait for one of them to finish. When one of the remote sessions finishes, the loop continues and launches another session. When the number of sessions launched equals the number of jobs, then the loop stops launching more. The final WaitFor _all_ ensures the macro waits for the final sessions to finish, before execution continues within the spawning session.
%Macro runJobs(sessions=, force=N);
%Let colon=:;
%If %eval(&sessions. > 12) and &force. eq N %then %do;
  %Put WARNING&colon. runJobs is limited to 12 sessions by default. If you know what you are doing, use Force=Y to ignore.;
%Abort Cancel;
%End;

*number up the jobs;
Data _jobQueue;
  Set _jobQueue;
  job = _N_;
Run;

*find out how many jobs we have;
Proc SQL noPrint;
  Select count(job)
  Into :nJobs
  From _jobQueue
  ;
Quit;

*find out what variables we have to pass over;
Proc Contents data=_jobQueue noDetails noPrint out=_jobVars;
Run;

Proc SQL noPrint;
  *job vars;
  Select name
  Into :jobVars separated by "|"
  From _jobVars
  Where lower(name) ne "code"
  ;

  *number of job vars;
  Select count(name)
  Into :nJobVars
  From _jobVars
  Where lower(name) ne "code"
  ;
Quit;

* loop that launches remote sessions;
%Do iJob = 1 %to &nJobs.;
    Proc SQL noPrint;

      Select code
      Into :code
      From _jobQueue
      Where job = &iJob.
      ;

      *create jobVar values locally so they can be pushed across;
      %Do iJobVar = 1 %to &nJobVars.;
      %Let jobVar = %scan(&jobVars., &iJobVar., |);

      Select &jobVar.
      Into :&jobVar.
      From _jobQueue
      Where job = &iJob.
      ;
  %End;
    Quit;

  SignOn R&iJob. Wait=Yes;

  %sysLPut _ALL_;

  RSubmit Log="[\\path to some log location]\R&iJob..log" New Wait=No ConnectPersist=No cMacVar=R&iJob.;
    Option noSyntaxCheck;
    %Include "&code.";
  EndRSubmit;

  *use cMacVar to tell how many are still running;
  %Let running = 0;
  %Do iCMacVar = 1 %to &iJob.;
    %If &&R&iCMacVar. = 2 %then %do;
      %Let running = %eval(&running. + 1);
    %End;
  %End;

  %Put running=&running.;

  %If %eval(&running. >= &sessions.) %then %do;
    WaitFor _ANY_;
  %End;
%End;
WaitFor _ALL_;
%MEnd runJobs;

Source: link

Recent Questions on sas

    Programming Languages