Using SAS Catalogs to Develop and Manage a SAS Project

advertisement
NESUG 2009
Administration & Support
Using a SAS Catalog to Develop and Manage a SAS® Project
David D. Chapman, US Census Bureau, Washington, DC
ABSTRACT
A key concept in program management is to develop the code in one place, make changes at one location, move
the code to where it is needed for testing or use, and when making changes make sure changes work before
modifying production code. SAS catalogs are ideal for developing, testing, and managing data step programs.
This paper reviews SAS catalogs and the different kinds of entries they contain. It discusses SOURCE, LOG,
OUTPUT, Macro, Format, and CATAMS entries. For each an example is given of how to put it into a catalog, how
to retrieve if from the catalog, and how to use it. A discussion is given of how to manage and sequence code
coming out of the catalog that make up the SAS project data steps and procedure programs. The use of PROC
CATALOG to view catalog contents and copy elements to another location, and PROC UPLOAD and PROC
DOWNLOAD to move the SAS catalogs to a production location on a different computer are discussed.
SAS CATALOGS
SAS catalogs are special SAS files that store different kinds of information in small units called catalog entries.
Each entry has an entry type identifying its purpose to the SAS System. A single SAS catalog can contain different
types of catalog entries. Some catalog entries contain system information such as key definitions. Other catalog
entries contain application information such as window definitions, help windows, formats, informats, macros, or
graphics output. You can list the contents of a catalog using various SAS features, such as SAS Explorer and
PROC CATALOG.
SAS catalog entries are fully identified by a four-level name of the form: “libref.catalog.entry-name.entry-type”. An
example is “NESUG.PAPER_AS08.CONTROL.SOURCE”. You commonly specify the two level name for an
entire catalog, as follows: libref.catalog (e.g. NESUG.PAPER_AS08). “libref” is the logical name of the SAS data
library to which the catalog belongs. Catalog is a valid SAS name for the file.
The entry or element name and type are required by some SAS procedures. If the element or entry type has been
specified elsewhere or if it can be determined from context, you can use the entry name alone. To specify entry
names and entry types, use this form: entry-name. entry-type (e.g. control.source). “Entry-name” is a valid SAS
name for the catalog entry; “entry-type” is assigned by SAS when the entry is created.
CATALOG ELEMENTS
A SAS catalog is a special type of SAS file that contains elements. All elements in a file can the same type of
element or all elements can be a different type. Different types of elements are described below. A catalog can
contain all the code and information necessary to execute a data step program.
There are many different types of catalog elements. Elements most commonly used with a data step program are
listed below. The use of these elements is given in later sections.
Types of Catalog
Elements/Entries
SOURCE
FORMAT
LOG
MACRO
OUTPUT
CATAMS
SOURCE
The source element holds basic data step or procedure code. There can be a different element for each data step
and procedure or a data step can be divided between several different elements. Source elements are the same
as a text file used to hold SAS code, original macro statements, or other general purpose statment such as
options. Code is added to a catalog source element either interactively or in batch. When it is created in batch a
data _null_ statement is used. In the example code given below a “PROC PRINT” statement is written to the
element “PROC_PRINT” of the type “SOURCE ” in the catalog “PAPER_AS08" in the SAS library NESUG.
1
NESUG 2009
Administration & Support
FILENAME CODE CATALOG "NESUG.PAPER_AS08.PROC_PRINT.SOURCE";
DATA _NULL_;
FILE CODE ;
PUT "PROC PRINT";
RUN;
The LOG associated with inserting this code in the catalog “PAPER_AS08” in the library “NESUG” is given below.
1
LIBNAME NESUG "C:/NESUG2009";
NOTE: Libref NESUG was successfully assigned as follows:
Engine:
V9
Physical Name: C:\NESUG2009
1 !
RUN;
2
3 FILENAME CODE CATALOG "NESUG.PAPER_AS08.PROC_PRINT.SOURCE";
4 DATA _NULL_;
5
FILE CODE ;
6
PUT "PROC PRINT";
7 RUN;
NOTE: The file CODE is:
Catalog Name=NESUG.PAPER_AS08.PROC_PRINT.SOURCE,
Catalog Page Size=4096,
Number of Catalog Pages=7,
Created=Monday, June 15, 2009 07:55:53 PM,
Last Modified=Sunday, July 12, 2009 06:09:44 PM,
File Name=C:\NESUG2009\nesug2008.sas7bcat,
Release Created=9.0101M3,Host Created=XP_PRO
NOTE: 1 record was written to the file CODE.
The minimum record length was 10.
The maximum record length was 10.
NOTE: DATA statement used (Total process time):
real time
0.06 seconds
cpu time
0.01 seconds1
FORMAT
Formats are commonly used with data step programs. Formats are used to recode variables used to produce
tables using PROC TABULATE or PROC REPORT, or to display data in output. PROC FORMAT is used to
create the formats and store them in the catalog. Formats can be created, stored in a catalog, and retrieved from
the catalog for later use.
User defined format are created using PROC FORMAT. During creation they can also be stored in the catalog.
The code below created a user defined format call “region” and stores it in a catalog name “PAPER_AS08" in the
previously define SAS library “NESUG”. The user defined formed has an entry type of “format” and an element
name of region. The code below illustrates creating a user defined format in a catalog that assigns on the the four
census regions based on one of the 9 census divisions.
PROC FORMAT LIBRARY=NESUG.PAPER_AS08;
VALUE
REGION
1="NorthEast"
2="NorthEast"
3="Central"
4="Central"
5="South"
6="South"
7="South"
8 ="West"
9 ="West" ;
RUN;
2
NESUG 2009
Administration & Support
80
PROC FORMAT LIBRARY=NESUG.PAPER_AS08;
81
VALUE
REGION
82
1="NorthEast"
83
2="NorthEast"
84
3="Central"
85
4="Central"
86
5="South"
87
6="South"
88
7="South"
89
8 ="West"
90
9 ="West" ;
NOTE: Format REGION has been written to NESUG.PAPER_AS08.
91
RUN;
NOTE: PROCEDURE FORMAT used (Total process time):
real time
0.01 seconds
cpu time
0.00 seconds
This format that assigns census region based on census division can now be made available from the catalog file
“paper_as08” by setting an option. Once a format as been stored in a catalog, it can be accessed by specifying
the system option FMTSEARCH (). The FMTSEARCH() options tells SAS to first look at the catalogs identify by
the options before using a format in the system catalog “WORK.FORMAT” to define the format. If you move the
catalog, you must either change the name of the libname or redefine the current libname to reflect the catalog’s
new location.
Options fmtsearch (NESUG.PAPER_AS08);
SAS searches for formats in a specific order.
CATAMS
A CATAMS element is an element for holding data. This data can be retrieved from the catalog to create a SAS
data set or view. In theory, the size of the data set created is limited only by the size of the catalog that can be
created. In practice, data sets created from CATAMS elements are often used to hold program parameters. One
application uses a CATAMS element to hold IP addresses of different computer systems. An example of code to
create a CATAMS catalog element. The example writes data in the SAS dataset SASHELP.COMPANY to the
catalog element “COMPANY.CATAMS” and then prints the data from the catalog.
FILENAME DATA
CATALOG
"NESUG.NESUG2008.COMPANY.CATAMS";
DATA _NULL_;
FILE DATA;
SET SASHELP.COMPANY;
PUT LEVEL1 $
LEVEL2 $
LEVEL3 $
LEVEL4 $
LEVEL5 $
JOB1
$
DEPTHEAD $;
RUN;
3
NESUG 2009
Administration & Support
DATA COMPANY_VIEW / VIEW=COMPANY_VIEW;
INFILE DATA;
INPUT LEVEL1 $
LEVEL2 $
LEVEL3 $
LEVEL4 $
LEVEL5 $
JOB1
$
DEPTHEAD $;
PUT _INFILE_;
RUN;
PROC PRINT DATA=COMPANY_VIEW;RUN;
The LOG file associated with creating a CATAMS element name “company.catams” from the data set
SASHELP.COMPANY is given below.
100
101
102
103
104
105
106
107
108
109
110
111
112
FILENAME DATA
CATALOG
"NESUG.NESUG2008.COMPANY.CATAMS";
DATA _NULL_;
FILE DATA;
SET SASHELP.COMPANY;
PUT LEVEL1 $
LEVEL2 $
LEVEL3 $
LEVEL4 $
LEVEL5 $
JOB1
$
DEPTHEAD $;
RUN;
NOTE: The file DATA is:
Catalog Name=NESUG.NESUG2008.COMPANY.CATAMS,
Catalog Page Size=4096,
Number of Catalog Pages=7,
Created=Monday, June 15, 2009 07:55:53 PM,
Last Modified=Sunday, July 12, 2009 06:11:27 PM,
File Name=C:\NESUG2009\nesug2008.sas7bcat,
Release Created=9.0101M3,Host Created=XP_PRO
NOTE: 48 records were written to the file DATA.
The minimum record length was 57.
The maximum record length was 85.
NOTE: There were 48 observations read from the data set SASHELP.COMPANY.
NOTE: DATA statement used (Total process time):
real time
0.14 seconds
cpu time
0.04 seconds
113
114 DATA COMPANY_VIEW / VIEW=COMPANY_VIEW;
115
INFILE DATA;
4
NESUG 2009
Administration & Support
116
INPUT LEVEL1 $
117
LEVEL2 $
118
LEVEL3 $
119
LEVEL4 $
120
LEVEL5 $
121
JOB1
$
122
DEPTHEAD $;
123
PUT _INFILE_;
124
RUN;
NOTE: DATA STEP view saved on file WORK.COMPANY_VIEW.
NOTE: A stored DATA STEP view cannot run under a different operating system.
NOTE: DATA statement used (Total process time):
real time
0.06 seconds
cpu time
0.01 seconds
LOG AND OUTPUT
A normal part of a SAS program is the production of a LOG and OUTPUT files. This information can be stored in
the catalog containing the code to document the program’s operation and the original code that made up the
program. Doing this makes the code almost self documenting. This is useful when a new catalog is created for
each use. The code below illustrates how to use the “PROC PRINTTO” procedure to store results from the
OUTPUT and LOG windows in the program catalog.
PROC PRINTTO NEW
LOG
=NESUG.NESUG2009.PROGRAM_LOG.LOG
PRINT =NESUG.NESUG2009.PROGRAM_LOG.OUTPUT;
RUN;
PROC CATALOG CATALOG=NESUG.NESUG2009;
CONTENTS;
RUN;
PROC PRINTTO ;
RUN;
The code above puts the LOG statements associated with executing the PROC CATALOG statement into the
element program of type LOG and the output of the procedure into the element program of type OUTPUT.
129
130
PROC PRINTTO ;
RUN;
NOTE: PROCEDURE PRINTTO used (Total process time):
real time
0.00 seconds
cpu time
0.00 seconds
131
132 PROC PRINTTO NEW
133
LOG
=NESUG.NESUG2009.PROGRAM_LOG.LOG
134
PRINT =NESUG.NESUG2009.PROGRAM_LOG.OUTPUT;
135
RUN;
NOTE: PROCEDURE PRINTTO used (Total process time):
real time
0.03 seconds
cpu time
0.01 seconds
5
NESUG 2009
Administration & Support
146
147
148
PROC CATALOG CATALOG=NESUG.NESUG2009;
CONTENTS;
QUIT;
NOTE: PROCEDURE CATALOG used (Total process time):
real time
0.03 seconds
cpu time
0.03 seconds
PROGRAM RELATE CATALOG ELEMENTS
Most catalog elements are related to the storage of data step/procedure code or program output. Some SAS
procedures make special use of the catalogs. Three SAS procedures that do this are PROC REPORT,
SAS/GRAPH, and the SQL/QUERY Window. PROC REPORT uses a catalog to store table code. SQL/Query
window uses the catalog to store saved queries. The output of SAS/GRAPH is stored by default in a catalog with
one element for each graph.
The LOG below is an example of storing PROC REPORT code to a catalog and later recalling and using it from
the catalog is given below.
This code writes the code to the catalog.
151
152
153
154
155
156
157
158
PROC REPORT DATA=COMPANY_VIEW MISSING NOWD HEADLINE
OUTREPT=NESUG.NESUG2009.REPORT01 ;
COLUMN LEVEL3 LEVEL4 N;
DEFINE LEVEL3 / GROUP;
DEFINE LEVEL4 / GROUP;
BREAK AFTER LEVEL3 / SKIP OL SUMMARIZE;
RBREAK AFTER
/ SKIP OL SUMMARIZE;
RUN;
NOTE: The infile DATA is:
Catalog Name=NESUG.NESUG2008.COMPANY.CATAMS,
Catalog Page Size=4096,
Number of Catalog Pages=7,
Created=Monday, June 15, 2009 07:55:53 PM,
Last Modified=Sunday, July 12, 2009 07:08:02 PM,
File Name=C:\NESUG2009\nesug2008.sas7bcat,
Release Created=9.0101M3,Host Created=XP_PRO
{lines deleted to save space}
NOTE: Definition stored in NESUG.NESUG2009.REPORT01.
NOTE: 48 records were read from the infile DATA.
The minimum record length was 57.
The maximum record length was 85.
NOTE: View WORK.COMPANY_VIEW.VIEW used (Total process time):
real time
0.26 seconds
cpu time
0.01 seconds
NOTE: There were 48 observations read from the data set
WORK.COMPANY_VIEW.
NOTE: PROCEDURE REPORT used (Total process time):
6
NESUG 2009
Administration & Support
real time
cpu time
0.32 seconds
0.03 seconds
This code uses the saved code from the catalog to create a second table.
161
162
163
PROC REPORT REPORT =NESUG.NESUG2009.REPORT01
DATA=COMPANY_VIEW NOWD;
RUN;
{lines deleted to save space}
NOTE: There were 48 observations read from the data set WORK.COMPANY_VIEW.
NOTE: PROCEDURE REPORT used (Total process time):
real time
0.12 seconds
cpu time
0.04 seconds
CONTROLLING PROGRAM FLOW
To use the catalog in complex data step programs, we need to retrieve multiple pieces of program or procedure
code from the catalog in a specific sequence. In practice, this can be done by creating a “master” or “control”
source element that manages the flow by specifying what elements will be used in what order.
The master element would look like the code below. This code runs programs A, B, C, and D sequentially. The
LOG and LISTING output is written directly to program catalog.
FILENAME CONTROL CATALOG ‘NESUG.PAPER_AS08';
PROC PRINTTO NEW
LOG =NESUG.PAPER_AS08.PROGRAM.LOG
OUTPUT=NESUG.PAPER_AS08.PROGRAM.OUTPUT;
%INCLUDE CONTROL(PROGRAM_A)/SOURCE2;
%INCLUDE CONTROL(PROGRAM_B)/SOURCE2;
%INCLUDE CONTROL(PROGRAM_C)/SOURCE2;
%INCLUDE CONTROL(PROGRAM_D)/SOURCE2;
If the control code is stored in a source element named “PROGRAM_FLOW”, the program to executed all this
code would only three lines of code.
LIBNAME NESUG ‘C:/NESUG’ ;RUN;
FILENAME CONTROL CATALOG ‘NESUG.PAPER_AS08';
%INCLUDE CONTROL(PROGRAM_FLOW)/SOURCE2;
The “%INCLUDE” statement inserts the contents of either the file or catalog element referred to for program
execution. The “/SOURCE2" option echos and prints the code coming from the catalog to the program log.
This code executes the code in other source elements (e.g. program_a, program_b, program_c, and program_d )
in sequence. The contents of the output and log windows are stored in the catalog “PAPER_AS08". The control
element can be created either in batch or interactively. Creating the control in batch would look something like
this;
FILENAME
CONTROL
catalog
‘NESUG.PAPER_AS08.program_flow.source’;
data _null_;
file control ;
PUT ‘FILENAME CONTROL CATALOG ‘NESUG.PAPER_AS08';
PUT ‘PROC PRINTTO NEW
LOG =NESUG.PAPER_AS08.PROGRAM.LOG
7
NESUG 2009
Administration & Support
PUT
PUT
PUT
PUT
PUT
OUTPUT=NESUG.PAPER_AS08.PROGRAM.OUTPUT;’
‘%INCLUDE CONTROL(PROGRAM_A)/SOURCE2;’
‘%INCLUDE CONTROL(PROGRAM_B)/SOURCE2;’
‘%INCLUDE CONTROL(PROGRAM_C)/SOURCE2;’
‘%INCLUDE CONTROL(PROGRAM_D)/SOURCE2;’
‘PROC PRINTTO;RUN;’
Programs can may be started either interactively or in batch. The key to this is either to use the options on the pull
down menus to put code in the program editor or to construct a SAS program file to do it in batch. Code can be
submitted interactively by going to the file pull down menu and picking “Open Object” Once the catalog and entry
are selected, you can pick “Open in editor” to type the code into the program editor where it can be submitted.
MANAGING THE CATALOG
Once program code is developed in a catalog, it often needs to be moved from a development directory or
computer to a production directory on the production computer. There are several ways to do this. When the
catalog is moved to a different directory on the same computer, PROC CATALOG or PROC DATASETS can be
used. When the catalog is to be moved onto a different computer SAS/CONNECT with PROC UPLOAD or PROC
DOWNLOAD can be used.
PROC CATALOG
PROC CATALOG is a procedure used to manage and move a catalog. It is also used to show the contents of a
SAS catalog and move elements from a catalog in one directory to different catalog in some other directory. The
code below illustrates how this is done.
PROC CATALOG
CAT=NESUG.NESUG2009 ;
COPY OUT =WORK.NESUG2009;
RUN;
PROC CATALOG
CAT=WORK.NESUG2009;
CONTENTS;
RUN;
The LOG showing the results of a copy is given below.
177
178
179
PROC CATALOG
CAT=NESUG.NESUG2009 ;
COPY OUT =WORK.NESUG2009;
RUN;
NOTE:
NOTE:
NOTE:
NOTE:
NOTE:
NOTE:
NOTE:
NOTE:
NOTE:
Copying entry TEST.FRAME from catalog NESUG.NESUG2009 to catalog WORK.NESUG2009.
Copying entry PROGRAM.LOG from catalog NESUG.NESUG2009 to catalog WORK.NESUG2009.
Copying entry PROGRAM_LOG.LOG from catalog NESUG.NESUG2009 to catalog WORK.NESUG2009.
Copying entry PROGRAM_LOG.OUTPUT from catalog NESUG.NESUG2009 to catalog WORK.NESUG2009.
Copying entry REPORT01.REPT from catalog NESUG.NESUG2009 to catalog WORK.NESUG2009.
Copying entrxy CONTROL.SOURCE from catalog NESUG.NESUG2009 to catalog WORK.NESUG2009.
Copying entry SAMPLE_25093.SOURCE from catalog NESUG.NESUG2009 to catalog WORK.NESUG2009.
Copying entry SAMPLE_25391.SOURCE from catalog NESUG.NESUG2009 to catalog WORK.NESUG2009.
Copying entry SAMPLE_35648.SOURCE from catalog NESUG.NESUG2009 to catalog WORK.NESUG2009.
NOTE: PROCEDURE CATALOG used (Total process time):
real time
0.07 seconds
cpu time
0.00 seconds
181 PROC CATALOG CAT=WORK.NESUG2009;
182
CONTENTS;
183
RUN;
8
NESUG 2009
Administration & Support
PROC CATALOG is used to list all the elements in a catalog. An example of the list of catalog elements produced
by the PROC CATALOG D is given below.
# Name Type
Create Date
Modified Date
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
1 ONE
SOURCE 06DEC2002:18:24:31 06DEC2002:18:24:31
2 READ SOURCE 06DEC2002:17:26:07 06DEC2002:17:26:07
3 THREE SOURCE 06DEC2002:18:24:56 06DEC2002:18:24:56
PROC UPLOAD/DOWNLOAD AND SAS/CONNECT
SAS/CONNECT is used to transfer files between two different computers or to use files on two different computers
at the same time. One computer is referred to as the local computer (often a PC); the other the remote computer
(often a UNIX or OpenVMS Server). PROC UPLOAD is used to move files from the local to the remote computer;
PROC DOWNLOAD is used to move files from the remote computer to the local computer. The code below is
remotely submitted after a connection has been made with the remote computer.
PROC UPLOAD
INCAT=DEVELOPMENT.PGM_CODE
OUTCAT=PRODUCTION.PGM_CODE;
RUN;
The key is to use the “incat” and “outcat” options. PROC UPLOAD and PROC DOWNLO0AD – part of transfer
services under SAS/CONNECT – is another way to move catalogs between different computer systems. This is
also a situation when remote library services under SAS/CONNECT may be appropriate.
DOCUMENTING THE CATALOG
Since code is used directly from the catalog, documentation of the catalog is the same as documentation of the
code. Documentation can be done using a macro based on PROC CATALOG and ODS to display the source
catalog elements in a PDF file. The code documenting the catalog does the following things:
1.
2.
3.
4.
Set macro variables identifying the the library and catalog name.
Capture the output of PROC CATALOG using ODS and place it into a SAS dataset.
Count the number of elements in the catalog and assign the element name to a macro variable
Print each element in the catalog to a PDF (or any other) file.
Set Macro Variables
This code initializes two macro variables – &lib_name and &cat_name – identifying the library name and catalog
name.
%Let LIB_NAME = ‘NESUG'
%Let CAT_NAME = 'NESUG2009'
;
;
Use ODS and PROC CATALOG To Place Element Names Into a SAS dataset
The second part of the code uses ODS to capture the the output of the PROC CATALOG procedure. The
procedure is used to retrieve the name and type of each catalog element.
ODS OUTPUT
CATALOG_RANDOM=&lib_name..&cat_name.list;
PROC CATALOG CAT=&lib_name..&&cat_name;
CONTENTS;
QUIT;
Assign Each Element Name to a Macro Variable and Counts the Number of Elements
This section of code counts the number of source elements in the catalog. Each element is placed in a separate
macro variable.
9
NESUG 2009
Administration & Support
DATA _null_
;
SET &lib_name..&cat_name.list END=LAST;
IF TYPE = "SOURCE" THEN DO ;
CNT+1;
COUNT+1;
CNT_C="L"||left(PUT(CNT,2.));
PUT CNT_C;
CALL SYMPUT(CNT_C,OBJNAME);
PUT '**' objname;
FILENAME XX CATALOG "&LIB_NAME..&CAT_NAME..&OBJNAME..SOURCE" ;
END;
IF LAST=1 THEN DO;
PUT "LAST RECORD = " COUNT ;
CALL symput ('cat_COUNT', COUNT);
END;
RUN;
Print Contents of Each Source Element in Catalog to a PDF (or any other) File.
The fourth and final section of code is a macro name “%PRINT” that creates a list of all source elements in the
catalog and for each source catalog element shows the contents of the element.
%MACRO PRINT;
*Prints a list of Elements in the catalog;
Title01 ‘Documentation of &lib_name..&cat_name. Catalog’;
Title02 ‘List of Elements in the Catalog &lib_name..&cat_name. ‘;
PROC PRINT
run;
%DO ELEMENT=1 %TO &CAT_COUNT;
filename codelib catalog "&lib_name..&cat_name..&&L&ELEMENT...source";
data print;
infile codelib;
input CODE $ 1-50;
run;
TITLE02 "CATALOG &lib_name..&cat_name..&&L&ELEMENT...SOURCE";RUN;
PROC PRINT PRINT data=print
;run;
%END;
%MEND;
The code below executes the macro %PRINT.
ods PDF file="c:\nesug2009\code_documentation.pdf" ;
%PRINT ;
ods PDF close;
After running this macro, a pdf file called “code_documentation” is created with contents of each source element
starting at the top of the page. The name of the source element is printed at the top of the page.
TESTING NEW CODE
During program development or maintenance, you often need to replace or modify the code. To avoid problems it
is wise to try the new code before actually making the change. SAS makes this easier with CATNAME statement.
The CATNAME statment logical concatenates two catalogs together under on logical name called a “catref”.
10
NESUG 2009
Administration & Support
The code below illustrates this.
CATNAME work.program_code (developent.test_code,project.production_code);
filename code catalog
work.program_code ;
%include code (run) / source2;
run;
In this code the contents of the two catalogs “test_code” and “production code” are combined into one logical
catalog name “program_code” in the work library. This logical catalog is associated with the filename “code”.
When the “%include code(run )” is executed, SAS looks to first to the test_code catalog in the development library
and then to the production_code catalog for the version of the element “run.source” to use. This allows us to use
test code instead of production code in the test without actually making a change in the production catalog.
SAS has specific rules for concatenation of catalogs. The concatenation catalog is searched in the order listed on
the statement from left to right and the first occurrence of the entry found is used. When a catalog is opened for
output, it will be created in the first catalog listed. When an element is deleted or renamed, only the first occurrence
of the entry is affected. Any time a list of catalog entries is specified, only the first occurrence is given. The effect
of these rules are that when new test code is placed in a catalog ahead of the production catalog. The new test
code will be used and the production code left unaffected.
CONCLUSION
Catalogs are excellent tools for the management, development, and testing of traditional data step code. All code
(source statements, formats, macros, and parameters) are stored in a single file – a SAS catalog. Moving the
catalog file moves everything needed to execute the program. The key statement in the use of catalogs is the file
name statement with the catalog option.
REFERENCES
SAS Institute Inc., SAS LANGUAGE: CONCEPTS, Cary, NC, SAS Institute Inc., 1999, 554 pages.
SAS Institute Inc., SAS LANGUAGE: REFERENCE, Cary, NC, SAS Institute Inc., 1999, 554 pages.
ACKNOWLEDGMENTS
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS
Institute Inc. in the USA and other countries. ® indicates USA registration.
DISCLAIMER
This paper reports the results of research and analysis undertaken by Census Bureau staff. It has undergone a
more limited review by the Census Bureau than its publications. This report is released to inform interested
parties and to encourage discussion.
CONTACT INFORMATION
Your comments and questions are encouraged. Contact the author at:
David D. Chapman
Quality Assurance Staff
Economic Planning and Coordination Division
US Census Bureau
Washington, DC 20233-6100
Work Phone: (301) 763-6535
Email: david.d.chapman@att.net
11
Download