Go Back   Rhinocerus > Newsgroup > Newsgroup comp.soft-sys.sas

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 12-07-2005, 07:06 PM
Michael Raithel
Guest
 
Posts: n/a
Default Re: Possible to run a SAS program within another SAS program?

Dear SAS-L-ers,

Julie posted the following:

> Hello, I have 9 SAS programs, all within the same Windows
> folder that I usually run at the same time - one right after
> the other. For convenience, is it possible to write a simple
> SAS program that will let me run all the programs at once or
> to have a program that will allow me to pick and choose which
> SAS programs I want to run (e.g., in the case I only want to
> run the first 3 and last program out of the 9 SAS
> programs) and which order the programs are run in? I guess
> what I'm really looking for is if there is a way to call
> another SAS program using only a couple lines of code so
> that, if I choose not run that program, I can just comment
> that code out or something like that. Let me know if this is
> possible, thanks!!!
>


Julie, I see that Nevin Krishna beat me to the punch with what I would
have suggested for a solution. So, I thought that I would give you an
example of a construct that I use. I often use a "driver program" to
order and execute a number of other SAS programs. Here is an example,
ripped from Appendix A of my SUGI 30 paper
(http://www2.sas.com/proceedings/sugi30/035-30.pdf):


************************************************** **********************
*****;
* Program: Driver_Program.sas
*;
*
*;
* Purpose: This program %INCLUDEs several SAS Macro programs and then
*;
* executes them so that data files in specified directories may be
*;
* processed.
*;
************************************************** **********************
*****;

************************************************** ***************;
* SAS Options, Formats, etc. *;
************************************************** ***************;
options noxwait xmin xsync;

************************************************** **********************
*;
* INCLUDE the Process_Flat_Files.sas SAS program that contains the
*;
* READFLAT SAS Macro. That Macro reads an individual data file's
records*;
* and stores the data in a permanent SAS data set.
*;
************************************************** **********************
*;
%include 'Q:\programs\Process_Flat_Files.sas';

************************************************** **********************
*;
* INCLUDE the SAS Macro program that identifies individual data files
*;
* in the specified data directory and builds macro calls that, in turn,
*;
* execute the READFLAT SAS Macro in the Process_Flat_Files.sas SAS
*;
* program for each file.
*;
************************************************** **********************
*;
%include 'Q:\programs\Identify_Flat_Files.sas';

************************************************** **********************
**;
* Execute the IDENTIFY SAS Macro in the Identify_Flat_Files.sas program
*;
* to identify and process the data files in each specified data
directory*;
************************************************** **********************
**;
%IDENTIFY(Q:\data,\\system1\input\datadir);

%IDENTIFY(Q:\data,\\system2\input\datadir);

%IDENTIFY(Q:\data,\\system3\input\datadir);

The program, above, first includes several SAS macros, and then executes
them. If they had not been macros, the programs would have executed in
the order in which they were %INCLUDEd into the driver program. So, all
I have to do is add, subtract, and move my programs around in the driver
program for them to execute in the order that I want them to dance in.

Julie, best of luck getting your programs in the proper order for
execution.


I hope that this suggestion proves helpful now, and in the future!

Of course, all of these opinions and insights are my own, and do not
reflect those of my organization or my associates. All SAS code and/or
methodologies specified in this posting are for illustrative purposes
only and no warranty is stated or implied as to their accuracy or
applicability. People deciding to use information in this posting do so
at their own risk.

++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++
Michael A. Raithel
"The man who wrote the book on performance"
E-mail: MichaelRaithel@westat.com
Author: Tuning SAS Applications in the MVS Environment
Author: Tuning SAS Applications in the OS/390 and z/OS Environments,
Second Edition
http://www.sas.com/apps/pubscat/book...tid=1&pc=58172

Currently Writing: The Complete Guide to SAS Indexes (due February 28,
2006)

++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++
Whenever I hear, 'It can't be done,' I know I'm close to
success. - Michael Flatley
++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++


Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Create macro variable to refer to program name - for multiple kat j Newsgroup comp.soft-sys.sas 0 07-26-2007 05:03 PM
Re: Create macro variable to refer to program name - for multiple toby dunn Newsgroup comp.soft-sys.sas 0 07-26-2007 03:11 PM
Create macro variable to refer to program name - for multiple kat j Newsgroup comp.soft-sys.sas 0 07-26-2007 02:58 PM
Re: How to Run a SAS program at given Calender date and time? Pardee, Roy Newsgroup comp.soft-sys.sas 0 06-21-2007 04:02 PM
Re: multicollinearity in proc logistic Bora Yavuz Newsgroup comp.soft-sys.sas 0 11-21-2006 02:02 PM



All times are GMT. The time now is 11:57 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.