As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Writing Testing Aware Programs

From sasCommunity
Jump to: navigation, search

Short url for this page:

Writing Testing-Aware Programs that Self-Report when Testing Options are True

Author: Ronald_J._Fehd


Program development proceeds through four phases: investigation, development, unit testing, and integration testing. Testing typically consumes 50% of project resources. Any programming effort spent in support of testing may significantly reduce project costs and help ensure the delivery of the project's product: a set of tested and integrated programs.

This paper examines the architectural issues of writing SAS(R) programs that are testing-aware: that have a variable Testing whose default value is false, which can be reset to true based on the values of options and which write information to the log when testing is true.

  • Topics covered include

options used for testing, both command-line and used-anywhere; example code for data step, includes and macro programs used as any of module, routine, or subroutine.

  • Audience: architects, designers, software engineers,

project managers, intermediate to advanced programmers, advanced users.

  • keywords: echoauto, macro, module, mprint, %oplist, options, parameterized include file, routine, source2, subroutine, testing, verbose
  • Information: programs using call execute to:
  1. call parametized include files and
  2. macros.


  • predecessor: FreqAll
  • provides set of testing programs
  • provides examples to implement demo version of FreqAll as
  1. parameterized includes
  1. macros


  • options echoauto, mprint, source2 and verbose
  • using %sysfunc(getoption(<OptName>)) to test option values in programs
  • using parameterized includes
  • using macros


  • using call execute to call macros
  • using call execute to call parameterized includes
  • using call execute with macro function nrstr


Download the Writing Testing-aware Programs zip file that contains 46 programs

  • programs shown in paper
  • R&D demo programs
  • <program>-Test
  • .bat for each .sas
  • .cfg
  • .pdf: Fehd-Writing-Testing-Aware-Programs.pdf 20 pages


-- created by User:Rjf2 30 July 2007

--Ronald_J._Fehd macro.maven == the radical programmer 07:39, 24 June 2012 (EDT)