LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2003, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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; x 'P:\SAS\SurveysDataMart\Scripts\sas_exe.bat'; /*END SAS VALIDATION COMMAND.*/

executes this batch program: /*START OF sas_exe.bat BATCH PROG.*/ sas "p:\sas\programs2\"; /*END OF BATCH PROG.*/

which executes this small include in batch mode: /*START OF SPAWNER INCLUDE*/ libname val 'P:\SAS\SurveysDataMart\SDS';

%let;/*HARDCODED PARAMETERS.*/ %let importdataset=val.new_v; %let comments=test spawner;/*COMMENT COULD BE SET TO SYSPARM.*/

%let begtime = %sysfunc(datetime()); %inc 'P:\SAS\Macros2\'; %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 ><radevenz@IX.NETCOM.COM> wrote: > >>"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 current >>> sas window. When it runs it launches some processes that cause it to >wait. >>> >>> For this reason it would be more useful to execute the macro in a new sas >>> 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 >macro >>> in the new window? Can it be done with an X command? >>> >>> Any help much appreciated. >> >>Ben: >> >>If you don't want to lose datasets, don't put them in work. I'm not sure >how >>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 would >>still have to pass at least one parameter to the session you are >starting... >>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 - >sysin. >>%let stub = %sysfunc(ranuni(0)).sas; >>data _null_; >> file "&stub"; >> name='parm1'; value=symget(name); put '%let ' name= value ';' ; >> name='parm2'; value=symget(name); put '%let ' name= value ';' ; >>... >>run; >> >>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. > >Ben

Back to: Top of message | Previous page | Main SAS-L page