You are on page 1of 34

Week 7 Introduction to SAS – The Basics

Unit 4
SAS for Data Management

Week 7: Introduction to SAS – The Basics

Welcome.

This reading is an introduction to getting in and out of SAS together with a set of
guidelines for navigation, programming, and documentation.

Hopefully, it will prove to be a handy reference.

Goals of Week 7: Introduction to SAS – The Basics

1. To learn how to enter and exit the SAS program;

2. To learn how to navigate the windows environment in SAS, including the creation
of user defined toolbar buttons;

3. To appreciate (and know the principles of writing) code that is organized and
clear;

4. To understand the “building block” structure of SAS syntax;

5. To begin a library of programming tips; and

6. To appreciate (and know how to design) a good project indexing system.

week 07 7.1
Week 7 Introduction to SAS – The Basics

Week 7 Outline – Introduction to SAS: The Basics


Section Topic Page

1. Introduction to the SAS Windowing Environment …………….. 3

2. How to Issue a SAS Command …………………………………. 7

3. How to Create Toolbar Buttons for Special Use ……..……….... 10

4. Modes of Running SAS for Windows ………………….………………. 13

5. How to Write and Execute SAS Code …………………………………. 16

6. Introduction to the Online Help System ..………………………………. 19

7. Introduction to Syntax for SAS Programs …………………………. 20

8. Take Care to Document Your Work …………………………………… 22

9. General Tips for Programming ………………………………………… 26

10. Archive Your Work ……………………………………………………….. 31

week 07 7.2
Week 7 Introduction to SAS – The Basics

1. Introduction to the SAS Windowing Environment

SAS version 8 operates through a windowing environment that lets you view and

work with programming statements, data files, results and file directories in a variety

of ways.

How to Start SAS

When you first start SAS software:

Start Æ
Programs Æ
The SAS System Æ
The SAS System for Windows V8

Alternatively, you may have a shortcut to SAS on your desktop.

5 main SAS windows are opened:

ƒ Explorer

ƒ Results

ƒ Program Editor

ƒ Log

ƒ Output

week 07 7.3
Week 7 Introduction to SAS – The Basics

Your screen will look as follows. The Results window will be hidden behind the

Explorer, and the Output window will be hidden behind the Program editor and log

windows. All five windows are seen to be open on the SAS task bar at the bottom of

the windows:

SAS Task Bar

All the basic tasks for managing data, programs and program output can be

accomplished in these windows. Other SAS features will use additional windows.

These will be described elsewhere.

week 07 7.4
Week 7 Introduction to SAS – The Basics

Table III: Description of 5 main SAS Windows:

Window Purpose
Explorer View and manage SAS files; perform
most file management tasks such as
moving, copying, opening and deleting
files.
Program Editor Enter, edit, and submit SAS programs
Log Displays messages about SAS session
and programs that you submit
Output Browse output from SAS programs that
have been run
Results Manage output (results) from SAS
programs that have been run – view,
save and print segments of output.

Following is the basic idea of using the SAS system.

• The user “writes” (“codes”) a set of instructions. These are strung together in a

program, and executed together in a batch, submitted for processing from the

PROGRAM window.

• The SAS system then displays Information on the action of the commands

(including any error messages) in the LOG window.

• Results are output by the SAS system to the OUTPUT window.

Thus, a program in SAS is actually comprised of 3 elements:

• The program
• The log
• The output

week 07 7.5
Week 7 Introduction to SAS – The Basics

Tip: Save the three elements of a SAS program (program, log, output) as a
group as follows.

• Use the same first level name, with extensions to match the contents. For
example, the executable program statements can be saved in a file called
file1.SAS to indicate that these are SAS program statements. The log and
output should be saved in files with the names: file1.LOG and file1.LST to
indicate their relationship to the program that created them.

• The .SAS, .LOG, and .LST extensions will be added automatically when you
save files from the program, log and output windows, respectively.

• The SAS system “looks” for and recognizes these extensions, and has
assigned icons to them. For example:

week 07 7.6
Week 7 Introduction to SAS – The Basics

2. How to Issue a SAS Command

There are four ways to issue commands:

• Pull down menus: These operate like the pull down menus in MSWord. The
particular menus that are available depend upon which is the active window
(indicated by the top bar highlighted in blue).

• The toolbar: A limited set of common commands are available on the toolbar –
again, this changes with the active window. You can program your own
buttons to add to the toolbar.

• The SAS command bar: You can type SAS commands directly in this bar and
hit <enter> to execute the command. Tip: This is generally not
recommended, except for commands such as “clear” or “submit”.

• Function keys: Commands can also be submit through the function keys. For
example,
o <F5> (pgm) moves you to the program editor window – makes it the
active window
o <F6> (log) moves you to the log window
o <F9> (keys) brings up the Keys window (shown below), which lists the
function key commands that are programmed.
o The keys window can also be found from the pull down menu:
ƒ Tools Æ Options Æ Keys.

o You may also program function keys that are unassigned:


ƒ Tools Æ Options Æ Enhanced Editor Keys.

week 07 7.7
Week 7 Introduction to SAS – The Basics

Pulldown menus

Toolbar
Command Bar

week 07 7.8
Week 7 Introduction to SAS – The Basics

You may find it simplest to use the mouse to select, open and save files, and to move

around the windows.

Tip: However, some of the commands are handy.

• It is useful to know some of the commands so that you can program buttons, or
use SAS commands in within SAS programs (e.g., programs that write other
programs.)

• The CLEAR command clears the contents of the currently active window.

• The SUBMIT submits the contents of the program window for execution.

• Tip: Take care to understand the SAVE command. The SAVE command is

executed from either the File menu, the command bar, the button on the
toolbar, or a function key. It saves the contents of the active window, not
your data. You can use this button to save a program, log or output file. Only
when you have a data file window open, does the SAVE command or clicking
the SAVE icon save your data file.

week 07 7.9
Week 7 Introduction to SAS – The Basics

3. How to Create Toolbar Buttons for Special Use in SAS

Within the SAS system, it is possible to create buttons to add to the toolbar that make

working with windows and files easier. The buttons are created using the TOOLS pull

down menu.

Example: Creating a button to Clear the LOG and OUTPUT Windows

1. Make your Program Editor the Active Window by clicking inside the
Program Window.

2. From the pull down TOOLS menu:


• Select Customize
• Select the Customize tab

week 07 7.10
Week 7 Introduction to SAS – The Basics

Click on the ADD TOOL button and select BLANK TOOL


• In the Command Box type:

o log;clear;output;clear;

• In the Help Text box type:

o Clear log and output windows

In the Tip Text box type:

o Clear log/out
(The ‘tip text’ is the text that will appear in the rollover box when you
move your cursor over the button, but do not click).

• Click on the Change Icon button: and select an icon for your button.

week 07 7.11
Week 7 Introduction to SAS – The Basics

• With the new button highlighted in the box, click on the up or down arrow

buttons to position the button where you would like it to appear on the
toolbar.
• Click on OK when it is located where you would like.
• Click on Yes to SAVE the new version of the toolbar.

Note: The toolbar in the PROGRAM window has been modified in this example. You

must repeat the steps if you would like the same button to appear on the toolbar in

the LOG or OUTPUT windows -- since these windows have a different toolbar. Start

the process with the LOG or OUTPUT window as the active window.

week 07 7.12
Week 7 Introduction to SAS – The Basics

4. Modes of Running SAS for Windows

SAS for Windows can be run in several different modes.

SAS
S t

SAS Programming
AS/Solutions
• Analysis
• Development
and SAS Windowing Batch
Programming Environment
• Reporting
• Accessories
• ASSIST
• Desktop
• Application
Builder

Introduction to the SAS/Solutions Mode

• The SAS System provides a set of ready-to-use solutions, applications, and

tools to accomplish specific analysis or data/file management tasks. Most of

these tools can be accessed by using the Solutions menu.

• A user of the solutions mode does not write programs. He or she works

through a series of point-and-click menus to select a data file, specific

variables and method of analysis.

• This mode of operation is not the focus in this course, because it does not lend

itself as readily to documentation as does programming.

week 07 7.13
Week 7 Introduction to SAS – The Basics

• However, for many of the Solutions applications, Version 8 of SAS does offer

the option of saving a program file based upon menu selections. The

Solutions menu may become a good way to explore and learn some new

applications in SAS, by saving the programming code produced by the

application that creates the results you desire.

Introduction to the Programming Mode

• SAS programming requires that the user write or edit a series of SAS statements,

called a program, to manage data or files and conduct analyses.

• In the windowing environment, programs are written or opened and edited in the

PROGRAM EDITOR Window, and then submitted for processing from that

window. The LOG window displays the executed code and messages, and the

OUTPUT window displays the results.

• Optionally, results can be written in HTML format to a browser window instead of,

or in addition to the standard SAS output window. If you are planning to display

results on the web, or if you prefer the table format created for browser output this

is a good choice.

week 07 7.14
Week 7 Introduction to SAS – The Basics

Setting Results Options in SAS

From the pull down TOOLS menu select Options Î Preferences


and then select the Results tab.

Check “Create HTML” if you wish to have an HTML version of your results

written. Note that there is a style box, which allows you to select the format for the

results tables. Color and shading are used in various combinations. I recommend

the choice “Minimal” to avoid color, shading and font changes. This is easier on

printing, and is preferable if you are likely to Xerox results. Additionally, you may

select the internal SAS browser or a different web browser for viewing results.

By checking/unchecking the “Create Listing” option, you will produce/not

produce results in the standard output window. When both options are checked you

get 2 versions of your results displayed, one in the output window, and one in a

browser window.

week 07 7.15
Week 7 Introduction to SAS – The Basics

5. How to Write and Execute SAS Code

There are a variety of choices for writing and editing SAS code.

• Text editor (such as Notepad)

• Word processor (be careful how you save your code)

tip: If you are using MS Word, it is important that you save your file as a

TEXT ONLY type of document and that you name it with the extension

“.sas”. TEXT ONLY documents contain only keyboard characters and

have no formatting or ASCII control characters or other special

characters. SAS does not allow such.

• The SAS PROGRAM window

The main advantage to working in a text editor or word processor is that you can

write or edit programs on a computer that does not have SAS loaded, and later run

the programs when you have access to SAS.

week 07 7.16
Week 7 Introduction to SAS – The Basics

The SAS PROGRAM EDITOR is a reasonably flexible editor, with cut, copy and

paste, as well as find and change commands.

• The ENHANCED PROGRAM EDITOR, new in version 8, uses color-coding and

dividing lines to help keep track of SAS syntax features and program flow.

The new enhanced editor has the potential of reducing programming errors

that are a simple matter of a typographical error – a missed quote or semi-

colon – but which can be very time-consuming to find when proofing and

testing programs. I strongly recommend that the new user work with the

enhanced program editor.

• When SAS is opened from the Start menu, the default active window is the

enhanced program editor. A program can be typed in, or a saved program

can be opened in the window, using the ‘Open’ button or Open option from the

File pull down menu.

• Alternatively, SAS and a program can be opened directly from the Windows

Explorer by double-clicking on a program file with a .SAS extension.

• Programs can also be submitted and run in Batch Mode. When a program has

been written and saved with a .SAS extension, the program can be run without

opening the SAS windows. To run a program in batch mode: from the

Windows Explorer, highlight and right-click on the program to be run. One of

the options on the menu is “Batch Submit”. Selecting this will submit the

program to the SAS processor. Files with the same first level name and the

extensions .LOG and .LST will be written to the same drive and directory as

week 07 7.17
Week 7 Introduction to SAS – The Basics

the program (.SAS) file. These will contain information on the execution of the

program (.LOG) and the program output (.LST).

Using batch mode submission has the advantage of increased speed when working

with large data sets, or when working on a machine with the minimum RAM

requirement for SAS. Loading the SAS window system itself uses a considerable

amount of RAM. This is avoided when submitting programs by batch mode.

week 07 7.18
Week 7 Introduction to SAS – The Basics

6. Introduction to the Online Help System

An online help system is available with SAS and is accessible from the menu bar.

The help feature includes a set of tutorials for learning to use the features of the SAS

windowing environment, along with a full reference feature for DATA step and

procedure commands and options.

week 07 7.19
Week 7 Introduction to SAS – The Basics

7. Introduction to Syntax for SAS Programs

The SAS system is a structured programming language in which there are two types

of “building blocks”, the DATA step and the PROCEDURE (PROC) step.

• Each of the steps is limited in scope and has defined input and output. As a

result, programs in SAS lend themselves to top-down design with

modularization.

• Indenting SAS statements in a DATA or PROC step, so as to highlight the

modularization, visually enhances this structure. The new Enhanced Editor

draws lines between steps in a program as an additional visual aid to

distinguish the two (DATA v PROC) types of program steps.

Introduction to the DATA Step

SAS DATA steps are used to create SAS data sets, and are used for data

manipulation. DATA steps create SAS datasets by giving instructions for reading

data into SAS, or for merging, sub-setting or updating existing SAS datasets, along

with adding new variables, or modifying existing ones.

Introduction to the PROC Step

SAS PROCs (procedures) read SAS datasets and perform specific functions, such as

listing the data (PROC PRINT), or producing charts or plots (PROC CHART, PLOT),

frequency tables (PROC FREQ), descriptive statistics (PROC MEANS, SUMMARY,

UNIVARIATE, TABULATE), and many other specialized functions and analyses.

week 07 7.20
Week 7 Introduction to SAS – The Basics

SAS procedures produce either results in the OUTPUT and/or browser window, or

create new datasets to be used in other procedures or data steps, or both.

There exist some key, NONNEGOTIABLE, syntax requirements

• The key syntax requirement is that

ALL SAS STATEMENTS END WITH A SEMI-COLON (;).

• Several short SAS statements may be written on the same line, with program

statements separated by semi-colons. Alternatively, a single statement may

span several lines, where a semi-colon indicates the end of the statement.

• SAS program statements can be typed in CAPITAL LETTERS or lower case

letters – these are equivalent. That is, capitalization of programming

statements is ignored. TIP: This is not true for data, which is case

sensitive.

week 07 7.21
Week 7 Introduction to SAS – The Basics

8. Take Care to Document Your Work

There are three self-documentation features of the SAS system: comments, titles,

and footnotes.

Introduction to Comments

• Comments can be placed in SAS programs to help explain the code or identify
modules. Comments appear in the LOG, but do not appear in the output. The
syntax for comments can take two forms:

* comment ; < first character in the statement is an asterisk (*). Comment


must end with a semicolon (;). In this form, the comment is a
SAS statement>

/* comment */ < comment is surrounded by /* */. In this form the comment


can appear within a SAS statement >

• In the Enhanced Program editor, comments appear in green. If you forget the
end semi-colon or */, the statements following the comment will still appear in
green.

• When the comment is in the first form (as a SAS statement), statements
immediately following the semi-colon will be read and executed. The second
form of comment can surround a block of SAS statements that include semi-
colons, but statements will not be executed until after the concluding */. This
can be useful when rerunning a program, when some section of the program
does not need to be rerun. Surrounding a section of code that is to be skipped
by /* and */ is called “commenting out” a section of code.

week 07 7.22
Week 7 Introduction to SAS – The Basics

• Comments should appear liberally to help clarify the programming steps.


This can be a tremendous aid in later proofreading, or in copying and using
code for another application at a later date.

Introduction to TITLES

• TITLES and FOOTNOTES are special SAS statements that print a title with
results, following the step containing the title statement. The syntax for title
statements is illustrated below. You are allowed up to 10 titles.
• The title that will be printed on each page of your results is contained in the
single or double quotes that follows the TITLE instruction.
• Following is an example

TITLE1 'Listing of Outliers'; < First title >


TITLE2 'Pilot Data'; < Second title >
TITLE3 “Columbia's Data” ; < Third title in double quotes>

Note: Double quotes must be used when the title itself contains a question
mark.

• A useful feature of the new enhanced editor is that: ‘All information within
quotes appears in purple.’ If you neglect to close a quote, the SAS
processor assumes the next lines are part of the quote – even semi-colons are
ignored. If several lines appear in purple – you may have a problem with
unbalanced quotes. This is a very common programming error.
• Capitalization appears on the output just as you typed it within the quotes.
Several titles can be specified, with the order of the titles indicated by the title
number. Titles stay in effect for all output until you write a new title statement.
• To get rid of all previous titles you can simply use the line
TITLE1;
• To keep the same first 2 title lines and replace the third use
TITLE3 ‘New Third Title’;

week 07 7.23
Week 7 Introduction to SAS – The Basics

• To replace an early title and keep subsequent ones, you must copy and repeat
all titles with higher numbers.
• The first title (Title1) will appear in the RESULTS window next to the
procedure name used to produce the output, as well as in the OUTPUT
window. The first title, therefore, can be a useful aid in navigating through
your output.

First titles used in


program

Introduction to FOOTNOTES

• Footnotes are similar to titles except that they will be printed on the bottom of

the output page. Footnotes have a similar syntax to titles as illustrated below:

FOOTNOTE1 'DATA were collected from 6/89-8/89';


FOOTNOTE2 'All values out of range were set to missing values';

• One useful practice is to reserve the first title or first footnote for the program
name, for easy reference to the program that produced the output. For
example, at the beginning of your SAS program, you could include a line:

Footnote1 ‘Program: HW01a.sas’;

week 07 7.24
Week 7 Introduction to SAS – The Basics

• This would appear beneath all subsequent output, as long as you don’t replace
it with a new footnote1 statement. This can be a tremendous aid in
documentation – linking a data table or graph directly to the program that
produced it.

week 07 7.25
Week 7 Introduction to SAS – The Basics

9. General tips for programming

Key among these – take time to plan. When writing programs, take time to

write a detailed step-by-step outline of what you want to accomplish first. You

can always revise as you go, but it helps save time wasted from missing

important steps and results in fewer errors. Other tips:

1. Don't compose on the computer.

Using your outline, write your program in SAS language on paper first. Initially,

and even as you become more proficient, it is hard to keep track of the editing

commands and at the same time focus well on writing a program.

2. Use comments, blank lines, and indenting so as to make it easier to follow

the flow and logic of your program.

This is a tremendous aid in proofreading and editing for errors, as well as in

making modifications in the program, or adapting a program for use in another

setting at a later date. “Talk to yourself” with comments as you go. Make your

programs user-friendly.

week 07 7.26
Week 7 Introduction to SAS – The Basics

3. Use a program header to keep track of when, where, and why the program

was written, what data sets were used, and what data sets were created.

A program header is merely a block of comments at the start of the program that

contains documentation information. In addition, use titles and footnotes to

label your results. To reiterate, reserving the first title or footnote for the

program filename helps link results to the program that produced them.

Example Program Header:

*_______________________________________________________________
*
* Corinne Jurgens 2003
*
* code: p02.sas
* path: z:\bigelow\consulting\jurgens 2003\sascode
* prog: carol bigelow
* date: February 15, 2003
*
* input: z:\bigelow\consulting\jurgents 2003\sasdata\jurgens.sas7bdat
* output: none
*
* title:
* What is the relationship between symptom awareness (HFSAS vars)
* and delay in care seeking (ACUTESXS, DOEDUR, DYSPDUR,
* ACUTEDYS,ORTHPDUR,PNDDUR,COUGHDUR,FATIGDUR,WTGAIN,EDEMA,ABDGIRTH,
* TACHYDUR,CPDUR,NAUSEA)
*
* summary:
* 1. For all 14 Y=delay in care variables, the distribution
* of Y is compared across strata defined by HFSASTOT
* Strata define quintiles of HFSASTOT, approx.
*
* 2. For the 6 Y=delay in care variables that are essential
* a Kruskal Wallis nonparametric anova is performed to
* see if Y=delay in care varies appreciably by
* HFSASTOT quintile
*
* The 6 delay in care seeking Y variables are ACUTESXS,
* DYSPDUR, ORTHDUR, ACUTEDYS, PNDDUR, and DOEDUR
*
*_________________________________________________________________;

week 07 7.27
Week 7 Introduction to SAS – The Basics

A header need not be this elaborate, but the essential information should be

available.

4. Use the OPTIONS Statement at the start of each program to control the

format of your resulting output.

The SAS defaults for line size and page size are designed to fit on a computer

screen, rather than a page of paper. Printing this way wastes paper as well as

breaking up tables and lists unnecessarily. To set output for 8.5 X 11 inch

paper, use values in the range of 55 to 60 for pagesize, and 78 to 128 for

linesize. If you select a larger number for linesize, you will need to print output

in “landscape” format or else select a small size font when printing. This saves

paper, as well as enabling more variables to be listed across a page. For

example:

OPTIONS LINESIZE=128 PAGESIZE=55;

can be used for most programming. The OPTIONS statement also gives you

control over printing of page numbers (NONUMBER turns numbering off), or

dates (NODATE turns date off). These and other options can be reset during the

program with subsequent OPTIONS statements. By default, SAS puts page

numbers on output, starting the numbering within a SAS session, not within a

program. Typically the numbers are irrelevant to a report. In addition, the date is

printed on the first title line, and output is always centered (side-to-side) on the

week 07 7.28
Week 7 Introduction to SAS – The Basics

page. I prefer to turn off these features, so a commonly used options line at the

start of a program is:

OPTIONS LINESIZE=110 PAGESIZE=55 NODATE NONUMBER NOCENTER;

5. It is good practice to always save your program before you run (submit) it,

when working in the SAS windows.

If you find you need to make changes in your program after reviewing the log

and output, first clear the log and output windows, return to the program

window, edit, and again save the revised version before resubmitting. The

enhanced editor has a nice feature: if you have modified the contents of the

program editor, but not saved it, an asterisk (*) appears next to the program

name in the task bar, as a reminder to save the program. If you fail to clear the

log and output windows, the new version will be appended to the old. You will

have a lot of garbage to deal with in the results window, as you try to figure out

which is the old and which the new version. You can easily save the contents of

the log and output windows from the final version, without a lot of other junk, as

long as you keep clearing the windows before resubmitting.

week 07 7.29
Week 7 Introduction to SAS – The Basics

6. Always review your log before looking at the output.

Check for error messages, other notes and messages on how the program ran,

including the number of observations in the data sets read and created.

Sometimes a mistake in your program won't produce an error message – the

program may be valid, but it just doesn't do what you want it to do. Often, this

kind of error can be picked up by a careful reading of the log, especially

checking for the number of variables and observations in a data set, when the

problem might be missed if you look only at the output. SO READ YOUR LOG!

7. Last but not least, as always, make back-up copies of your programs and

data sets.

Log and output files can be easily reproduced by re-running a program on the

same data, so keep track of you programs and data.

week 07 7.30
Week 7 Introduction to SAS – The Basics

10. Archiving your work

It is easy to lose track of all the data management and analysis activities associated

with even a small-scale study. Therefore, it is important to develop, ahead of time,

an easy system for documenting, indexing and filing your work. The following are

suggestions only -- you need to develop a system of your own, one that you like

and will actually use.

1. Use Internal Documentation.

Use program headers, and make generous use of comments within your

programs. If you have a copy of the program, you will then have (detailed)

information on its purpose, and when and where the program was used.

2. Use Back-up Disks

Spending an extra $1 per disk can be cheap compared to the time and effort

needed to replace lost data or analyses. For each project you should keep on

separate disks (2 copies each):

- Grant proposal
- Study protocols, forms
- Data and associated files (e.g. .rec, .chk, .qes files in EpiInfo)
- SAS program files (*.sas files)
- SAS data sets (*.sas7bdat files in SAS V8)
- Reports and memos
- Manuscripts or presentation files (include final analysis data set)

Always save SAS data files and SAS program files on disk.

You may choose to save log and output files on disk, and/or to print hard

copies. The log and output can be recreated as long as you have the data and

SAS code.

week 07 7.31
Week 7 Introduction to SAS – The Basics

Disks can be named or labeled. In the Windows Explorer, under the

File Menu ÆProperties, a label can be assigned to a disk.

Disk label

This label should then be written on the stick-on disk label, in addition to your name

and any other information you deem pertinent. In your documentation, keep track of

which disk you use to store which files!

Be sure to label all your disks with your name, and perhaps phone and/or office

number. The chances are great that at some point in your career here you will leave

a disk behind in one of the computer labs.

week 07 7.32
Week 7 Introduction to SAS – The Basics

3. Name Your Files According to a System

Always use the .SAS extension for SAS program files, .LOG for the

associated log and .LST for the associated output. The SAS system

recognizes these files extensions, and enables options such as batch

submission of programs, and use of the SAS Viewer to review log and output

files from the Windows Explorer.

Icons for SAS


files:

program
(.sas) log
(.log)
output (.lst)

Choose a naming convention for the first part of the filename that is easy

for you to understand. Since the number of programs that can be developed

on a project can grow astronomically, a simple name with a numbering system

is recommended. For example for the Warm/Cold Cardiac Surgery Pilot

study, the prefix WCP was used and programs were and then numbered

sequentially. The first program was WCP01.sas, followed by WCP02.sas, etc.

If programs were modified or rerun, this was always noted in the header. If the

program was significantly modified, a new version was named: WCP01a.sas.

week 07 7.33
Week 7 Introduction to SAS – The Basics

Choose names that allow you this flexibility. Another suggestion is that

programmers on a study use their own set of names (so that two programmers

don’t produce two different files having the same name). One suggestion is to

use programmer’s initials in the name, e.g. for the Warm/Cold study, one set

of files were WCP*.sas, one student used WCS*.sas, another WCM*.sas, etc,

based on the user’s initial.

4. Index Your Work

Create an index of all management and analysis activities. This index should

describe the name and location (name of disk, where stored) of every data set;

the name, purpose and location (name of disk and notebook or file drawer) of

every program file. This index should be updated on a regular basis. For

example, make it standard practice to reserve an hour every Friday to update

your project index.

Example Project Index

Date Program Description


- - Code book
2-6-03 Formats.sas Defines formats
2-13-03 P01.sas Proc contents and descriptives (alphabetic)
2-15-03 P02.sas Delay in care seeking – by quintile of HFSASTOT
2-22-03 P03.sas Delay in care seeking – by quintile of HFSFACT1
2-23-03 P04.sas Delay in care seeking – by quintile of MSPQTOT
2-23-03 P05.sas Delay in care seeking – by quintile of MUISTOT
2-25-03 P06.sas Delay in care seeking – by quintile of AGE
2-27-03 P07.sas Delay in care seeking – by hx of previous heart failure
2-28-03 P08.sas Regression analysis of ACUTESXS
2-28-03 P09.sas Regression analysis of DYSPDUR
2-28-03 P10.sas Regression analysis of ORTHPDUR
3-2-03 P11.sas Regression analysis of PNDDUR
3-2-03 P12.sas Regression analysis of DOEDUR
3-2-03 P13.sas Regression analysis of ACUTEDYS
3-2-03 P14.sas Six Sets of ONE Predictor Models
3-13-03 P15.sas Wilcoxon Rank Sum Tests of Gender Differences in Awareness

week 07 7.34

You might also like