BookmarkSubscribeRSS Feed
trevi83
Calcite | Level 5

Hi all,

I have this code that it create more parallel processes:

%do i_quest=1 %to 20;

   signon mcq&i_quest. sascmd="!sascmd";
   %syslput serverwork=%sysfunc(pathname(work)) /remote=mcq&i_quest.;
   %syslput servertemp=%sysfunc(pathname(temp)) /remote=mcq&i_quest.;
   %syslput serverout=%sysfunc(pathname(output)) /remote=mcq&i_quest.;
   %syslput serverlk=%sysfunc(pathname(lookup)) /remote=mcq&i_quest.;
   %syslput i_quest=&i_quest. /remote=mcq&i_quest.;
   %syslput main_dir_macro=&main_dir_macro. /remote=mcq&i_quest.;

   rsubmit mcq&i_quest. wait=no sysrputsync=yes;
   OPTIONS SYMBOLGEN SOURCE SOURCE2 MPRINT;
   OPTIONS FULLSTIMER;
   OPTIONS MPRINT;
   OPTIONS MAUTOSOURCE SASAUTOS="&main_dir_macro.";
  
   %test;

       endrsubmit;
  %end;

  %do i_quest=1 %to 20;

   waitfor _all_ mcq&i_quest.;
   signoff mcq&i_quest.;

  %end;

I need to kill all processes while they still running.

I have found this code:

data _null_;

        cmd = "'taskkill /fi " ||'"' || "PID EQ &PID" || '"' || "'";

        call symput('taskcmd',trim(left(cmd)));

    run;

    filename TaskKill pipe &taskcmd;

    data _null_;

        infile TaskKill lrecl=229 pad;

        input @1 CommandResponse $char229.;

        put CommandResponse;

    run;

  This code kills the process with PID (Process ID= macro variable &sysjobid) but if I run this code, it kills only the parent process while the child processes continue running.

Is there anyone who can help me?


Thank you!


Trevi

1 REPLY 1
trevi83
Calcite | Level 5

I found the solution. best regards Smiley Happy

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 395 views
  • 0 likes
  • 1 in conversation