Home    Contents

Windows in SAS
File management

The SAS Program
Program syntax
Debugging tips

1. Prepare the data set 
   Types of data 
   Example programs    
2. View the data
   SAS Procedures
3. Explore the data  
   Numeric statistics    
   Frequency tables    
4. Manipulate the data  
   Basic techniques    
   New variables
5. Adding Variables and 
Observations to Data Sets
   The SET Statement
   The MERGE Statement

6. Data Processing
   ARRAY Statement
   Do Loops
   By-Group Processing
   RETAIN Statement

 Simulated clinical data 
 Simulated Manitoba Health 


The SAS system provides a way of creating and/or accessing a variety of data sets, with techniques for manipulating the data to obtain output ranging from simple frequency tables to complex three-dimensional graphs. SAS software is available from the University of Manitoba for employees and students; more detailed information regarding SAS is available from the SAS website.

The goal of the MCHP online SAS tutorial is to provide the new user with enough knowledge of SAS to translate basic research questions into SAS code, enabling completion of the research project required by the Epidemiology of Health Care course at the University of Manitoba. Additional "intermediate" training material has been developed for new users of the MCHP data bases; this documentation covers arrays, do loops, first/last by-group processing, retain statements, and how to work with dates. (Complete SAS Institute manual documentation is available online under Academic Software References, Vendor Reference Materials, on the Software Team Resources Page, recognized with University of Manitoba IP addresses.)

A printable version of the manual is available in pdf format (manual.pdf). A printable draft is being prepared, as well, of sections of the manual which might be more appropriately organized into an appendix; for example, all material related to working with the simulated Manitoba Health data (appendix.pdf).

The MCHP online SAS tutorial is best viewed using at least Version 3 of Netscape or Internet Explorer, with a minimum setting on an SVGA monitor of 256 colours, 800x600 pixels. It was developed for use with SAS Release 9.1 (Windows 95/98 or Windows NT operating system). In addition to the usual system Help menu, this version of SAS provides additional information to licenses under the Help headings of "SAS OnlineDoc" and "Online Tutor".


As a self-guided tutorial, it is suggested that the user review the general guidelines and SAS program syntax first. The remaining material might then be followed sequentially: how to prepare a data set, how to view the data, how to explore and manipulate the data, how to add observations and variables to a data set, and how to process the data. (If the user runs SAS and the browser simultaneously, example code can be copied from the browser to the Program Editor window in SAS.)

Several sample data sets are referenced:

  1. Height/weight - is used throughout for illustrative purposes.
  2. Simulated clinical - can be created by the user to complete the questions found at the end of the sections on viewing, exploring, manipulating, adding variables and observations, and processingthe data (with links to how the program, log, and output should look).
  3. Simulated Manitoba Health - the data set used by students of the Epidemiology of Health Care course to complete the required assignments, only obtainable from MCHP, not from this tutorial. Additional questions are included here, for use with this data set, complete with links to the program, log, and output.

SAS has improved its interface to the point where a lot of analysis can be simply and quickly carried out using menus, examples of which are provided in the alternatives to programming section. It is often desirable, however, for users to have a basic understanding of SAS programming. Knowledge of SAS programming facilitates not only spotting some of the pitfalls inherent in processing data, but also maintaining more complete documentation of all the steps required to produce any given output. It is all too frequently necessary, in the course of carrying out research, to reproduce results which may have required a complex series of data processing steps.

It is important to recognize that there is often no one "right" way of obtaining accurate results. For simplification and continuity, this document reflects one style of writing SAS code. There are other more or less efficient ways of constructing SAS code, however, all of which may produce identical results. Where alternatives exist for generating results, a legitimate, and often preferred, choice is code that the user understands.

Resources, References and Acknowledgments

Contact: Charles Burchill       Telephone: (204) 789-3429
Manitoba Centre for Health Policy
Department of Community Health Sciences, University of Manitoba
4th floor Brodie Centre
408 - 727 McDermot Avenue
Winnipeg, Manitoba R3E 3P5       Fax: (204) 789-3910
Last modified on Friday, 30-Jun-2006 07:15:00 CDT