Dear SAS-L-ers, David Fickbohm posted the following: > I am writing a report that counts the number of widgets produced by > partners. I have a small routine that finds the partners id > number and > name. Obviously I could copy this code into my program and > execute it. I was wondering if there was a more elegant way > of "Calling" a SAS program > from within a SAS program. I am running SAS 8.1 in windows. > David, there sure is a more elegant way; and a simple one at that! Simply use the %INCLUDE statement. The %INCLUDE statement allows you to include a SAS program file containing a snippet of code or to include an entire SAS program. Here is what it might look like: %include "C:\Davids\Directory\Widget_Routine.sas"; In the statement, above, every single solitary individual distinct unique line in the Widget_Routine.sas file will be plopped into your SAS program at the point where the %INCLUDE statement is executed. So, be careful that if it is a SAS code snippet (e.g. not a complete DATA step), you sandwich the %INCLUDE within the boundaries of a DATA statement and RUN statement. David, it couldn't get any easier than that! Best of luck to you in your effort to be inclusive in calling on your already-written SAS programs! 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/bookdetails.jsp?catid=1&pc=58172 Currently Writing: The Complete Guide to Creating and Using SAS Indexes (due Summer 2005) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ The right to be heard does not automatically include the right to be taken seriously. - Hubert Humphrey +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++