Practical Data Management
and Statistical Computing (BioEp691F)
Outline: Lec1 Lec2
Lec3 Lec4
Lec5 Lec6
Lec7 Lec8
Lec9 Lec10
Lectures: Lec1
Lec2 Lec3
Lec4
Lec5
Lec6
Lec7
Lec8
Lec9
Lec10
Lecture 10
1.
More on Creating Permanent SAS
Formats
Review: Read notes on PROC FORMAT for character
variables in Lecture 9.
- Recommended Strategy:
- Illustrates linking of formats with variables in data sets
(dmes99p14.sas with output).
These formats will be available in the SAS session in which
they were created and stored as permanent formats.
- Create named permanent format data set, and link format
names to variables in permanent SAS data set (dmes99p15.sas
with output)
- At a new SAS session, read in saved formats and SAS data
set, and print (dmes99p16.sas with
output)
Also, read Cody and Smith, Chapter 13. pp309-310 "I. Permanent SAS
Data Sets with Formats."
- Saving format references to a Permanent SAS data set using
automatic Library option in PROC FORMAT (creates FORMAT.SC2 file).
(see dmes99p14.sas). We recommend not using this since the same
format file name will be used for all formats in a directory. If
formats are included for more than one data set (with the same
name corresponding to different values), the results will be
confused. We recommend instead naming the format file with the
CNTLOUT option in PROC FORMAT.
- Illustrates automatic naming of permanent format data set
(dmes99p17.sas with output).
When saved as permanent formats, the formats are not accessible in
the same SAS session unless they are read in (using CNTLIN, or
OPTIONS FMTSEARCH=( libref); )
Note inclusion of the OPTION
NOFMTERR to prevent program from stopping.
- Find the formats (named FORMAT.SC2), and use in a data set.
Note the addition to the OPTIONS statement of
FMTSEARCH=( libref); .
(dmes99p18.sas with output).
2. Reading Data With Multiple and
Unequal Lines per Subject (Record)
Reading: Cody and Smith, Chapter 12. Pages 285.