<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Submitting a long running job in batch mode from a stored process in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102669#M3741</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Bago!&amp;nbsp; I'm experienced in SAS programming but less so with Stored Processes.&amp;nbsp; All Usage Notes, SGF's papers, useful links, etc. are &lt;STRONG&gt;more&lt;/STRONG&gt; than welcome!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 May 2012 11:48:58 GMT</pubDate>
    <dc:creator>ScottBass</dc:creator>
    <dc:date>2012-05-03T11:48:58Z</dc:date>
    <item>
      <title>Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102667#M3739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We submit our stored processes via the Stored Process Web Application.&amp;nbsp; My particular stored process is using prompts to provide a user interface to the user.&amp;nbsp; However, since the actual processing can take a long time (30-60 minutes) to run, the "heavy lifting" is done by a SAS job running in batch.&amp;nbsp; The actual results will be emailed back to the user as a PDF attachment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the code isn't that long, I've included it below.&amp;nbsp; What I'd like to know is if this is best practice, or if there is a better approach?&amp;nbsp; In particular, the documentation says:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P class="column"&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 8.000000pt; font-family: 'NewCenturySchlbk';"&gt;_ACTION &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 8.000000pt; font-family: 'NewCenturySchlbk'; font-weight: bold;"&gt;Used By &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: NewCenturySchlbk; font-size: 8pt;"&gt;Web Clients &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 8.000000pt; font-family: 'NewCenturySchlbk'; font-weight: bold;"&gt;Description &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: NewCenturySchlbk; font-size: 8pt;"&gt;Specifies an action for the Web application to take. Possible values for this variable are as follows: &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 8.000000pt; font-family: 'NewCenturySchlbk';"&gt;BACKGROUND&lt;BR /&gt; executes the stored process in the background. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone explain what this means exactly?&amp;nbsp; How is "background" different than "not background"?&amp;nbsp; The documentation doesn't make this clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stored Process (the prompts are dynamic lists based on SASHELP.SHOES for Region, Subsidiary, and Product):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%STPBEGIN;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;OPTIONS VALIDVARNAME=ANY;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;*&amp;nbsp; End EG generated code (do not edit this line);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/*&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Set all necessary macro variables.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;If they are macro variables that you want sent to the batch job,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;best practice is to create them all with the same prefix.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;I am using the prefix "batch_".&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Otherwise you need to change the PROC SQL code below.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;* macro variables sent to the batch job ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let batch_username = &amp;amp;_username;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let batch_jobname&amp;nbsp; = Test SAS Batch Job;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/*&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Create a Stored Process (STP) session, which allocates the temporary SAVE library.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;This library is used to pass parameters between the STP and the batch job.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;While we are creating the STP session, also create the confirmation message.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Note that the "email when the job finishes" must be generated by the batch job,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;not this Stored Process.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data message;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; * session timeout is in seconds - 2 minutes should be plenty ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if _n_ = 1 then do;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if libref('SAVE') ne 0 then do;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc = stpsrv_session('create',2*60);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; infile datalines truncover;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; input message $200.;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; keep message;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; datalines4;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Job &amp;amp;batch_jobname submitted at %sysfunc(strip(%sysfunc(datetime(),datetime18.))).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;You will receive an email when the job finishes.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;libname save list;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/*&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;This macro variable must be set AFTER the session is created.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let batch_save_library=%sysfunc(pathname(save));&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/*&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Now copy the desired parameters (macro variables) to the SAVE library.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;This dataset will be used by the batch job to recreate the macro variables.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc sql noprint;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; create table save.parameters as&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,value&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dictionary.macros&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; where&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name like 'BATCH_%'&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/*&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Setup the parameters for invoking SAS, then launch the SAS job.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;You MUST pass in the path to the SAVE library location via sysparm.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;My preference is to use a configuration file, rather than command line options,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;with ALL other job configuration (eg. -sysin) done in the configuration file.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;This gives the maintainer of the code ONE place to go to change the batch job options.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;However, you can configure this however you wish.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let sas=C:\SAS\Config\Lev1\SASApp\sas.bat;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let config=&amp;amp;batch_config_file;&amp;nbsp; /* if you have created a hidden STP parameter,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; otherwise hard code this here */&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let sysparm=&amp;amp;batch_save_library;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let options=;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;* invoke the SAS batch job ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;systask command "&amp;amp;sas -config &amp;amp;config -sysparm ""&amp;amp;sysparm"" &amp;amp;options" nowait;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/*&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Now display the confirmation message to the user.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;The options nomerror and noserror suppress warning messages in the log&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;for unresolved macro and unresolved macro variable references.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;HTML code in particular can have tokens (eg. &amp;amp;program=...) that look like macro variables&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;but are HTML tokens instead.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let options=%sysfunc(getoption(merror,keyword)) %sysfunc(getoption(serror,keyword));&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;options nomerror noserror;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data message;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set message;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; message=resolve(message);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;options &amp;amp;options;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;title;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;options nonumber nodate;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc report data=message nowd noheader center ls=96 spacing=0;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; columns message;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; define&amp;nbsp; message / width=96 " ";&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;*&amp;nbsp; Begin EG generated code (do not edit this line);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;*';*";*/;quit;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%STPEND;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;*&amp;nbsp; End EG generated code (do not edit this line);&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here's a sample SAS batch job:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/*&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Allocate the SAVE library passed in via sysparm&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;libname save "%scan(&amp;amp;sysparm,1,%str(^|))";&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/*&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Set macro variables passed in to the batch job by the Stored Process&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; set save.parameters;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; call symputx(name,value,"G");&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/*&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;The rest of your program goes here...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;You would process the macro variables just like you would in a stored process.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;* Print macro variables ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;options nocenter;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc sql;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; select&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; name,value&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; from&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dictionary.macros&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; where&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; name like 'BATCH_%' and scope="GLOBAL"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; order by&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; name&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;* Print SASHELP.SHOES filtered on input parameters ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;* Note:&amp;nbsp; %stp_seplist processes the STP parms, creating a separated list ;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;options mprint;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%macro stp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; %local where;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; %let where=%sysfunc(sum(&amp;amp;batch_region_count,&amp;amp;batch_product_count,&amp;amp;batch_subsidiary_count));&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; options noserror nomerror;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; data subset;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set sashelp.shoes;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if (&amp;amp;where) %then %do;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where 1&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if (&amp;amp;batch_region_count) %then %do;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and region in (%stp_seplist(batch_region))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if (&amp;amp;batch_product_count) %then %do;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and product in (%stp_seplist(batch_product))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if (&amp;amp;batch_subsidiary_count) %then %do;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and subsidiary in (%stp_seplist(batch_subsidiary))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if (&amp;amp;where) %then %do;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; options serror merror;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; proc print;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%stp&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/*&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Send email that the job has finished.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;* Create message dataset ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data mail;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; length parm $15 line $1000;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; infile datalines dsd dlm="|" truncover;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; input parm line;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; datalines4;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;| Your SAS job &amp;amp;batch_jobname has completed with return code rc=&amp;amp;sysrc..&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%sendmail(to=&amp;amp;batch_username,subject=%str(Job &amp;amp;batch_jobname has completed),content_type=text/html)&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 11:26:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102667#M3739</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2012-05-03T11:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102668#M3740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Scott,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you have a look at &lt;A href="http://support.sas.com/kb/39114"&gt;Usage Note 39114: Tips for running a SAS® Stored Process in Background mode using SAS® 9.2 &lt;/A&gt;? The Note explains what running in "background" means.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bago&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 11:37:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102668#M3740</guid>
      <dc:creator>Bago</dc:creator>
      <dc:date>2012-05-03T11:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102669#M3741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Bago!&amp;nbsp; I'm experienced in SAS programming but less so with Stored Processes.&amp;nbsp; All Usage Notes, SGF's papers, useful links, etc. are &lt;STRONG&gt;more&lt;/STRONG&gt; than welcome!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 11:48:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102669#M3741</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2012-05-03T11:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102670#M3742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've reviewed the Usage Note above.&amp;nbsp; Note that we don't have the complete EBI installation.&amp;nbsp; So, we don't have the Information Delivery Portal, Web Report Studio, or Information Map Studio.&amp;nbsp; We do have the Stored Process Web Application and WebDAV (although we haven't been using WebDAV at all).&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This URL does work though:&amp;nbsp; &lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;A class="jive-link-external-small" href="http://myserver.com:8080/SASContentServer/repository/default/sasdav/Users/sbass/"&gt;http://myserver.com:8080/SASContentServer/repository/default/sasdav/Users/sbass/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;although there is no content &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 12:04:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102670#M3742</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2012-05-03T12:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102671#M3743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Scott:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the code runs in the background - it allows the user to break away from the Web Browser session.&amp;nbsp; Else if you started running the stored process and closed the browser -- then your STP stops.&amp;nbsp; Long running STPs obviously creates a great chance that the user will close the browser without realizing what he/she did.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm blogging about STP topics at &lt;A href="http://www.bi-notes.com/tag/stored-processes/"&gt;Business Intelligience Notes for SAS BI User&lt;/A&gt;s and have co-authored a one-spot reference book about &lt;A href="http://www.bi-notes.com/the-50-keys-to-learning-sas-stored-processes/"&gt;learning Stored Processes&lt;/A&gt; that discussing topics such as this one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tricia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 12:40:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102671#M3743</guid>
      <dc:creator>SASBIROX</dc:creator>
      <dc:date>2012-05-03T12:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102672#M3744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm happy to buy the book, as long as it's appropriate to my environment - no IDP, WRS, IMS, AMO, etc.&amp;nbsp; SPWA and WebDAV (Jack Rabbit) only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 13:13:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102672#M3744</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2012-05-03T13:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102673#M3745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Scott,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I too am in the process of learning about stored processes after years of writing SAS code.&amp;nbsp; So I'm going to respond to your question with more questions, and a few suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My main question is why you chose to set off a batch job?&amp;nbsp; Perhaps only because the job runs a long time? (And agree, you might be better off looking into other background processing options).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hadn't seen people using stored procedures to kick off batch jobs, so curious to what others think of this approach?&amp;nbsp; On the one hand, it's a tempting approach to me.&amp;nbsp; Because as a newbie to stored processes, I would once again feel confident that I could control things like autoexec, config.sas, etc., without worrying about how these are set by an administrator.&amp;nbsp; I would also get a nice log file back, without needing to use proc printto or looking for server logs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But on the other hand, relying on kicking off a new SAS session feels a little bit like running home to what feels comfortable as a SAS programmer.&amp;nbsp; Rather than pushing for new approaches as a SAS developer.&amp;nbsp; And I can see down side to the approach, e.g. time to start up a new session, and more importantly by-passing of meta data security in the the new session (cuz it knows not of the meta data, right?).&amp;nbsp; Will look forward to seeing what those with more experience have to say.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For resources I've found handy, I would have found Both of Tricia Aanderud and Angela Hall's books helpful&amp;nbsp; (Building BI Using SAS and 50 Keys to Learning SAS Stored Processes).&amp;nbsp; If you have to choose one, I would get the Stored Process book since you don't have the full EBI setup.&amp;nbsp; It's great. Works through nice examples.&amp;nbsp; I see Tricia already recommended her Blog.&amp;nbsp; I've also found Don Henderson's blog to be a great resource: &lt;A href="http://hcsbi.blogspot.com"&gt;http://hcsbi.blogspot.com&lt;/A&gt;.&amp;nbsp; I just ordered Don's book, Building Web Application with SAS/Intrnet.&amp;nbsp; While it's a few years old, a friend of mind recommended it, and much of the content/logic/process is the same whether you are using the new BI tools / stored procedures or writing your own code.&amp;nbsp; And from seeing Don's blog, and SAS commuity postings, and responses to my questions here in the forums, I'm sure it won't disappoint.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 13:27:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102673#M3745</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2012-05-03T13:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102674#M3746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've thought about this a bit more, and wanted to know if the details of background processing are documented anywhere?&amp;nbsp; For example, does it spawn a new process under the sassrv credentials?&amp;nbsp; Can I change the text returned to the user when I launch a background STP?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, if I launch a batch process myself as documented above, and close my browser, will it kill the batch session (I suppose I could just try this...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2012 10:30:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102674#M3746</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2012-05-04T10:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102675#M3747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Quentin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm used to this model in other web based products.&amp;nbsp; The main one that comes to mind is PeopleSoft.&amp;nbsp; The web interface allows you to select a task, set some options, and submit it asynchronously.&amp;nbsp; You can then use another web interface to monitor the status of running tasks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The builtin background processing looks promising, now that I have a better understanding of what it does.&amp;nbsp; The SAS documentation is a bit "sparse" in this regard.&amp;nbsp; But hey, that's what usage notes are for, to fill in all the holes in the doc &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&amp;nbsp; Anyway, no sense reinventing the wheel if it's already perfectly round.&amp;nbsp; But I would love to know the details between the builtin background processing vs. my approach as documented above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The batch SAS job is started with metaautoresource "SASApp", so it will have the same libname settings as an EG workspace server session.&amp;nbsp; AFAIK, it will honor metadata security, although this isn't really a concern in my scenario.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll probably order the 50 Keys to Learning SAS Stored Processes book once Tricia gets back to me and confirms that it's suitable to my environment.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2012 10:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102675#M3747</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2012-05-04T10:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102676#M3748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Scott:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a link to the site where you can download the table of contents:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.bi-notes.com/the-50-keys-to-learning-sas-stored-processes/" title="http://www.bi-notes.com/the-50-keys-to-learning-sas-stored-processes/"&gt;http://www.bi-notes.com/the-50-keys-to-learning-sas-stored-processes/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Two of the chapters discuss using stored processes with the BI tools and the web.&amp;nbsp; The other information would be useful to learning how to write stored processes and giving you some ideas of the many ways these can be used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tricia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2012 23:31:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102676#M3748</guid>
      <dc:creator>SASBIROX</dc:creator>
      <dc:date>2012-05-25T23:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102677#M3749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This background processing method is very useful for me in an web application that I'm building as previously my browser wasn't showing it had finished processing.&lt;/P&gt;&lt;P&gt;Whilst the adding the _action=background to the URL to get the stored process working in the background, how can I know if it has error?&lt;/P&gt;&lt;P&gt;I'm rather dubious of setting something up without a method of being able to flag errors.&lt;/P&gt;&lt;P&gt;There seems to be a mention of the 'Stored Process Alerts Portlet' but when I artificially trigger an error, nothing is flagged in it.&lt;/P&gt;&lt;P&gt;In addition, as I currently open a new page through a link to call the stored process (e.g. target=_blank), is there a way of calling the stored process and then closing the window?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 12:45:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102677#M3749</guid>
      <dc:creator>thesasgeek</dc:creator>
      <dc:date>2012-07-12T12:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102678#M3750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since my original post, I've progressed this project to its conclusion, including a couple SAS TS tracks, and can provide more comments.&amp;nbsp; These comments also address some of Quentin's questions above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did continue with my approach, i.e. STP submitting a secondary SAS batch job, rather than reworking the STP for background processing.&amp;nbsp; Some of the reasons:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) I have more control over the spawned SAS session:&amp;nbsp; output log location (rather than having the very long SAS log buried within the STP log), memory allocation for the batch SAS process, I can run it under another metadata userid, etc.&lt;/P&gt;&lt;P&gt;2) I have more control over the message displayed to the user.&amp;nbsp; I wanted more than just "Your job &amp;lt;whatever&amp;gt; has been submitted for background processing".&amp;nbsp; In particular, I wanted to let me know to expect an email with an attachment.&amp;nbsp; If SAS made it easier to customize the message returned from a background STP, on a per-STP basis, I would have considered the builtin background processing more strongly.&lt;/P&gt;&lt;P&gt;3) If something was completely haywire with the job, it's easier to kill the process via Process Explorer, rather than bringing down the entire STP server (I have RDP access to the remote SAS server).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I learned (via SAS TS) that, when the STP server starts, an authentication token gets created to authenticate to the metadata server.&amp;nbsp; However, when the STP server launched the SAS batch process (with the metaautoresource option), this authentication token for the metadata server was expired.&amp;nbsp; I was getting an invalid credentials message in the SAS batch session, and none of my pre-assigned libraries were being allocated.&amp;nbsp; The solution is to invoke the SAS batch process with the -metauser and -metapass options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had a few issues with quoting in building the SAS invocation command, esp. quoting such that macro parameters would be expanded.&amp;nbsp; See the attached stp_batch_submit macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My STPs had a hidden parameter batch_config_file with the path to a SAS config file, which contained all the invocation options for the batch job.&amp;nbsp; The STPs were streaming, not package, since I'm displaying a confirmation message back to the user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The STP code itself is quite simple:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;%&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* resolve embedded %sysget function call ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;%let&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; batch_config_file=&lt;/SPAN&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'SAS Monospace';"&gt;%unquote&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;(&amp;amp;batch_config_file);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;%&lt;STRONG&gt;&lt;EM&gt;stp_batch_submit&lt;/EM&gt;&lt;/STRONG&gt;(&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; config=&amp;amp;batch_config_file&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; ,mvars=name like &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;'BATCH_%'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; or name like &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;'_ODS%'&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;/* ,messagefile=C:\SAS\Config\%sysget(lev)\SASApp\SASEnvironment\SASCode\Saspgms\sample_stp.html */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, all the heavy lifting is done in the %stp_batch_submit macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@sasgeek, regarding your question "...is there a way of calling the stored process and then closing the window", you can do so with javascript.&amp;nbsp; In my code, I'm displaying a javascript alert, then closing the window.&amp;nbsp; I wouldn't want to close the window immediately, or the user wouldn't see the message!&amp;nbsp; See the stp_batch_submit macro for example code.&amp;nbsp; Note:&amp;nbsp; the javascript code has slightly different characteristics depending on browser (IE, Chrome, Firefox).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, I wrote some macros to help with this process, which I've attached to this post.&amp;nbsp; Wherever you see "parmv", substitute your own macro parameter validation code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2012 00:17:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102678#M3750</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2012-07-13T00:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102679#M3751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for posting, Scott!&amp;nbsp; This will be fun weekend reading.&amp;nbsp; You should consider developing it into a user-group paper.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A couple questions (that might be obvious once I dive in).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. If the stored process in running on stored process server (as SASSRV), I assume the spawned session also runs as SASSRV?&amp;nbsp; Is there a Unix- way to spawn a SAS session and have it run as somebody else?&amp;nbsp; I would love to have the sesion run as the actual user, rather than SASSRV.&amp;nbsp; (I know you can specify a different metadata identify for the spawned session).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. So when you spawn the session, I see where you are specifying the metadata identity in stp_batch_submit.sas:&lt;/P&gt;&lt;P&gt;%* We need to specify the user credentials for the spawned SAS job :&lt;BR /&gt;%let parms=&amp;amp;parms -metauser someuser -metapass {sas002}somepassword;&lt;/P&gt;&lt;P&gt;/*Invoke the SAS batch job.*/&lt;BR /&gt;systask command " ""&amp;amp;sas"" &amp;amp;parms " nowait;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you hard coding -metauser and&amp;nbsp; (encoded) -metapass?&lt;/P&gt;&lt;P&gt;Or if you want to just pass these along from whoever called the stored process, can you do that somehow? (I see SPWA creates &amp;amp;_METAUSER but obviously not &amp;amp;_METAPASS)&lt;/P&gt;&lt;P&gt;Obviously users could enter a password in a prompt, but ot sure you would really want to have users enter their password into a stored process prompt, where it could be easily revealed...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good stuff, thanks for sharing your results!&lt;/P&gt;&lt;P&gt;-Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2012 14:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102679#M3751</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2012-07-13T14:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102680#M3752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi SASGeek,&lt;/P&gt;&lt;P&gt;I think the best way to flag errors in SAS is to scan the log.&amp;nbsp; There are lots of NOTES/WARNINGS that I consider errors which SAS does not.&amp;nbsp; Tricia Aanderud was kind enough to let me write a guest post-on her blog suggesting an approach to automated log-scanning in a stored process setting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.bi-notes.com/2012/07/stored-process-ignore-log-your-own-peril/"&gt;http://www.bi-notes.com/2012/07/stored-process-ignore-log-your-own-peril/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you take a look, please let me know if you have any thoughts/suggestions.&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jul 2012 14:58:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102680#M3752</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2012-07-13T14:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102681#M3753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Quentin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;1. If the stored process is running on stored process server (as SASSRV), I assume the spawned session also runs as SASSRV?&amp;nbsp; Is there a Unix- way to spawn a SAS session and have it run as somebody else?&amp;nbsp; I would love to have the sesion run as the actual user, rather than SASSRV.&amp;nbsp; (I know you can specify a different metadata identify for the spawned session).&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes the spawned session runs as sassrv, but I changed the metadata userid to be our production user so the STP would have metadata access to all required libraries.&amp;nbsp; This was fine for my needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the Unix question, see the "su" and "sudo" commands.&amp;nbsp; However, you'd still need a password to switch to another user, unless you were running the su command as root.&amp;nbsp; Running the STP process as root (or the equivalent) would open all sorts of security issues and I'm not recommending it.&amp;nbsp; I would have a chat with your Unix sysadmin / security person if you want to do this.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if you're on SAS 9.3, IIRC SAS 9.3 has added streaming output to the workspace server.&amp;nbsp; So, you could have your STP run from a workspace server.&amp;nbsp; You'd have a slight performance hit as the workspace server started, but it would run under the userid who logged in to the SPWA.&amp;nbsp; I &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;think&lt;/STRONG&gt;&lt;/SPAN&gt; this is correct; I recall reading this in a "What's new in SAS 9.3" document.&amp;nbsp; If this does work as I think it would (I'm still on SAS 9.2 so can't test it), that's what I would do if it were critical that the STP run under the credentials of the logged in user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;2. So when you spawn the session, I see where you are specifying the metadata identity in stp_batch_submit.sas:&lt;/P&gt;
&lt;P&gt;%* We need to specify the user credentials for the spawned SAS job :&lt;BR /&gt;%let parms=&amp;amp;parms -metauser someuser -metapass {sas002}somepassword;&lt;/P&gt;
&lt;P&gt;/*Invoke the SAS batch job.*/&lt;BR /&gt;systask command " ""&amp;amp;sas"" &amp;amp;parms " nowait;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Are you hard coding -metauser and&amp;nbsp; (encoded) -metapass?&lt;/P&gt;
&lt;P&gt;Or if you want to just pass these along from whoever called the stored process, can you do that somehow? (I see SPWA creates &amp;amp;_METAUSER but obviously not &amp;amp;_METAPASS)&lt;/P&gt;
&lt;P&gt;Obviously users could enter a password in a prompt, but ot sure you would really want to have users enter their password into a stored process prompt, where it could be easily revealed...&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hardcoded the metauser and metapass in the macro, but I didn't have to do so.&amp;nbsp; In my environment, this does not pose a security risk.&amp;nbsp; However, if it did pose a risk, I would move these settings to the SAS configuration file, which is created by the developer of the STP (which in my case is me).&amp;nbsp; Or, the caller of the macro could add them as options.&amp;nbsp; In either case, the STP author would need to know the password of the specified metadata identity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See &lt;A href="http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/input.html" title="http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/input.html"&gt;http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/input.html&lt;/A&gt; (scroll to the bottom) for information on securing sensitive information such as passwords.&amp;nbsp; So, other than the hassle of requiring the user to enter his/her password in a prompt (say to feed to the sudo command), you should be able to do this in SAS in a secure manner.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2012 01:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102681#M3753</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2012-07-16T01:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102682#M3754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Scott,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yah, the ability to have workspace server send streaming results is what has me most excited about 9.3.&amp;nbsp; It will solve a lot of my security concerns.&amp;nbsp; The password masking stuff is neat (thanks for the link), but I think in my setting, any little ad-hoc app that collected passwords might raise eyebrows.&amp;nbsp; Hopefully we'll get 9.3 set up soon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2012 12:34:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102682#M3754</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2012-07-16T12:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102683#M3755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, Looks like I was wrong about 9.3 being the answer to my prayers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From:&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://support.sas.com/documentation/cdl/en/stpug/62758/HTML/default/viewer.htm#stpugwhatsnew93.htm"&gt;http://support.sas.com/documentation/cdl/en/stpug/62758/HTML/default/viewer.htm#stpugwhatsnew93.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looks like the Workspace Server can't replay images.&amp;nbsp; Very unfortunate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P class="item"&gt;&amp;nbsp; The SAS Workspace Server supports stored processes with streaming output, except stored processes that use sessions or replay (such as embedded images in streaming output).&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It also mentions a global macro var _METAPASS.&amp;nbsp; Does that mean that when a user logs into SPWA, their password would be saved in &amp;amp;_METAPASS (in an encrypted or at least encoded form?). &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;DIV class="paraSimpleFirst"&gt;Reserved global macro variables _ARCHIVE_PATH, _ARCHIVE_NAME, and _GENERATED_NAME have been added for publishing to WebDAV and Sharepoint. The _DEBUG_FILE reserved macro variable has been added for publishing to Sharepoint. Reserved global macro variables _FOLDER_PATH, _METAPASS, and _METAUSER have been added for publishing to subscribers. &lt;SPAN class="xrefSee"&gt;&lt;SPAN class="xrefText"&gt;For more information, see &lt;/SPAN&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/stpug/62758/HTML/default/p184mqqbi9w6qjn1q0619x19eg02.htm" title=""&gt;Using Reserved Macro Variables&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN class="xrefSee"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="xrefSee"&gt;--Q.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2012 20:51:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102683#M3755</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2012-07-16T20:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102684#M3756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Scott,&lt;/P&gt;&lt;P&gt;I’ve just briefly read all posts higher and I probably has easier solution for this task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So recently I had very similar task that you had, initially I implemented it&amp;nbsp; using only STP sessions only:&lt;/P&gt;&lt;P&gt;One STP session executes macro that runs for a few hours, another session – observe log file that this macro generates all this long time, and in the end, when log file become not in use by first STP session -&amp;nbsp;&amp;nbsp; second STP session parse this&amp;nbsp; log file and send needed info to needed person via sms/email etc.&lt;/P&gt;&lt;P&gt;But during testing I’ve found serious issue of such approach – these two STP sessions locked two sas processes that manages all another STPs, that impact STP response time, it become bigger that is not acceptable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I tried implement variant similar to your approach, but quickly refuse it because of it include changing sessions config files that has hardcoded some servers names etc. , and also probably such approach will be hard maintain , support and promote between servers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I decided join “batch processing” with “STP possibilities” to implement the task.&lt;/P&gt;&lt;P&gt;From STP I just create one table(or file, it’s not important) on some server path.&lt;/P&gt;&lt;P&gt;Then I created small flow via SAS management console, this flow has one file event,&amp;nbsp; - it waits until the file(or table) created by STP arrive on specific path on server.&lt;/P&gt;&lt;P&gt;After this file arrives – Flow runs.&lt;/P&gt;&lt;P&gt;Flow has two jobs, first job run this long time executed macro, in the end this job delete this table(file) created by STP.&lt;/P&gt;&lt;P&gt;After this job finished successfully or fails&amp;nbsp; - second jobs starts , this job executes parsing logs generated after first job executing, and send needed info to needed person via sms/mail etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Off course there are a lot of validations etc things . that I didn’t mentioned in this post, but shortly idea is from STP creates only some table(file) on specific place on server and create small and simple flow that waits for this file occurs(arrive) on this place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I said higher flow can be easy created and scheduled via SMC, and testing flow can be done from flow manager, that probably should be installed on your machine, if not -&amp;nbsp; it’s really easy install and configure it.&lt;/P&gt;&lt;P&gt;Benefits of such solution obviously – no need change any config files(session macros etc.) – easy maintain and support etc.&lt;/P&gt;&lt;P&gt;Minus is the fact that should be run some kind of demon( in my case it’s flow that waits for file arrives) that all time observe some directory on server, but I’m even not sure it is the minus, because it’s usual approach in scheduling process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this my post will help you a little bit if you would like change smth. In you actual functionaliti&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Dec 2012 16:02:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102684#M3756</guid>
      <dc:creator>Yura2301</dc:creator>
      <dc:date>2012-12-19T16:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102685#M3757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;THanks for sharing, Yura.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had been playing with scheduled flows in SMC, but hadn't realized I could kick of an event based on the arrival of a file in a directory.&amp;nbsp;&amp;nbsp;&amp;nbsp; Nifty approach to the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Dec 2012 14:35:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102685#M3757</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2012-12-21T14:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Submitting a long running job in batch mode from a stored process</title>
      <link>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102686#M3758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Actually it's very eazy realize event on file: arrives, exists, have some specific size...&lt;/P&gt;&lt;P&gt;Via SMC or Flow editor you should just choose "file event" and then choose needed value from dropdown(arrive, exist etc.) and put the path to needed file on Server.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Dec 2012 15:01:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Submitting-a-long-running-job-in-batch-mode-from-a-stored/m-p/102686#M3758</guid>
      <dc:creator>Yura2301</dc:creator>
      <dc:date>2012-12-21T15:01:40Z</dc:date>
    </item>
  </channel>
</rss>

