Date: Tue, 23 Dec 2003 07:46:56 -0500
Reply-To: Ben Powell <ben.powell@CLA.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ben Powell <ben.powell@CLA.CO.UK>
Subject: Re: Launch new sas instance to run macro
Thanks again for the replies to this. I've worked through Richard's
suggestions below and also the batch program suggestion from Ron. For some
reason I could not get the x command to execute a sas program from the
command line, hence the batch program, once the sas directory was added to
the path environment variable (XP).
So this command in SAS:
/*SAS COMMAND TO PERFORM VALIDATION, PARAMETERS HARDCODED.*/
options noxwait noxsync xmin;
/*END SAS VALIDATION COMMAND.*/
executes this batch program:
/*START OF sas_exe.bat BATCH PROG.*/
/*END OF BATCH PROG.*/
which executes this small include in batch mode:
/*START OF SPAWNER INCLUDE test_spawner.sas.*/
libname val 'P:\SAS\SurveysDataMart\SDS';
%let exportdataset=val.new;/*HARDCODED PARAMETERS.*/
%let comments=test spawner;/*COMMENT COULD BE SET TO SYSPARM.*/
%let begtime = %sysfunc(datetime());
%let tottime = %sysevalf ( %sysfunc(datetime()) - &begtime );
%put NOTE: Total Execution Time: %sysfunc(putn(&tottime,time9.));
/*END OF SPAWNER INSCLUDE.*/
The main mac2_data_val macro is then executed with the hardcoded variables.
I am thinking I will pass the comments variable through as a sysparm after
the file name in the batch program.
But thats a modification for the new year.
Right now I need a holiday!
Thanks again for the help sas-l,
On Mon, 15 Dec 2003 07:43:33 -0500, ben.powell@CLA.CO.UK wrote:
>On Fri, 12 Dec 2003 10:03:52 -0500, Richard A. DeVenezia
>>"Ben Powell" <ben.powell@CLA.CO.UK> wrote in message
>>> Dear SAS-Lers,
>>> I have a macro that runs using 5 parameters passed to it from the
>>> sas window. When it runs it launches some processes that cause it to
>>> For this reason it would be more useful to execute the macro in a new
>>> window (so I can carry on in the current one with extant datasets), and
>>> also because occasionally the process hangs which could cause me to lose
>>> any datasets in the current window.
>>> How do I pass macro variables from the current window to execute the
>>> in the new window? Can it be done with an X command?
>>> Any help much appreciated.
>>If you don't want to lose datasets, don't put them in work. I'm not sure
>>a hung process loses tables, if you manually kill the session, it's work
>>folder is usually left behind.
>>Some additional additional ways to pass parameters to another sas session
>>- Use a shared library and and table therein for the new session, you
>>still have to pass at least one parameter to the session you are
>>the table name containing the parameters.
>>- Suppose session 1 launches session X. Session 1 can write a program in
>>file named %sysfunc(ranuni(0)).sas, and then fire up session X using -
>>%let stub = %sysfunc(ranuni(0)).sas;
>> file "&stub";
>> name='parm1'; value=symget(name); put '%let ' name= value ';' ;
>> name='parm2'; value=symget(name); put '%let ' name= value ';' ;
>>options noxwait noxsync xmin;
>>x sas-startup-command -sysin &stub;
>>You might also get some mileage out of
>>SYSTASK, LISTTASK, KILLTASK, WAITFOR
>>Richard A. DeVenezia
>Thanks for the replies to this. I now have enough to keep me shut up for a
>couple of days. Richard, re losing datasets, yes I was able to dig them out
>of temp folders.