The MCHP SAS MANUAL - Simulated MB Health Data (Version 1)

         

Home    Contents

GENERAL GUIDELINES:
Windows in SAS
File management

The SAS Program
Program syntax
Debugging tips


 USING SAS PROGRAMMING TO: 
   
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
  
NON-PROGRAMMING 
      Alternatives

 
SAMPLE DATA SETS: 
 Height/weight
 Height/weight/region
 Simulated clinical data 
 Simulated Manitoba Health 
    

Sample Data Sets: Simulated MB Health - Version 1

Two versions were created of the program that creates a temporary SAS data set called "test" from the simulated Manitoba Health data available at MCHP, this data can be used to answer the accompanying questions.

Version 1, shown below, does not include labels or formats, so the output shows a list of unlabelled variables (in the CONTENTS output) and unlabelled values (in the PRINT output)

Information regarding record layouts (for raw files) and formats and labels (for all types of files) is normally available to the user as well. Version 2 adds labels (for labeling variables) and formats (for labeling values) from several files . The formats and labels specific to the simulated Manitoba Health raw data set are based on a record layout that describes all 33 variables.

Note: The data contained in the file fivet93m.raw is not available on the online tutorial, but is only available for workshops and courses run throught MCHP.

The following steps are required to create the output for Version 1:

  1. Ensure that the file called "fivet93m.raw" containing values for 5,000 observations is accessible (e.g., on A:\ or C:\ drive).

  2. Enter the following program directly into the SAS Program Editor window (the comments do not need to be entered). Two changes should be made:
    • The statement options linesize=min; does not need to be entered; this was used to reduce the width of the output so that it would fit on the website.
    • The FILENAME statement should be changed to reflect the actual location of the data on your system.

  3. Save the program (e.g., mb_cr.sas; do not save it as fivet93m.raw because this would overwrite the raw data set).

  4. Submit the program for processing.

  5. Check both log and output windows to ensure the program ran accurately. Debug the program, if necessary, saving and submitting it again (clearing the log and output windows first so that only the most recently-submitted versions will appear).

options linesize=min;

**==================================**
** f=readmb.sas                     **
**                                  **
** This program creates a temporary **
** SAS data set from the simulated  **
** Manitoba Health data             **
**==================================**;

     /* Assign a name ("rawdata") to the path and file */

filename rawdata
'c:\My Documents\My SAS Files\sasmanual\data\fivet93m.raw';

                                /* Begin the DATA step */

   DATA TEST;                /* Create "test" data set */
    INFILE RAWDATA;          /* Read the external data */

           /* Assign variable names, types & locations */
     INPUT
           NCASE     $  1-5
           GENDER    $    6
           AGE          7-9
           LOS        10-13
           NDAYICU    14-17
           TRANADM   $   18
           TRANDIS   $   19
           OP01     $ 20-23  /* This is numeric 0 */
           DIAG01   $ 24-28  /* This is numeric 0 */
           DIAG02   $ 29-33  /* This is numeric 0 */
           TOTCHAR    34-35
           CHARYES     $ 37
           SCHEDULE    $ 38
           RISKDRG     $ 39
           @40 DRGWT 6.4  /* 6 columns, incl. 4 decimal*/
           DRG      $ 46-48
           WBURG       $ 49
           DISCRE      $ 50
           REGIONRE    $ 51
           REGIONH     $ 52
           INCDR       $ 53
           TYPEHSP     $ 54
           DEATHSEP   55-58
           DRGRGN   $ 59-63
           SEVERDRG    $ 64
                        @65 RDRGWT 6.4
           CMG      $ 71-73
                        @74 RIW 7.4
           TREATY      $ 81
           ABSTYPE     $ 82
           DAYSFRPR   83-85
           DAYSTOR    86-88
           @89 ICD17BRK $char2. /* Keep leading spaces */
;                             /* End of INPUT statement*/
run;                          /* End of DATA step      */

      /* Obtain general information about the data set */
proc contents data=test;      /* Begin PROC step       */
run;                          /* End PROC step         */

/*Obtain values of all variables for the 1st 10 records*/

proc print data=test (obs=10);  /* Begin PROC step     */
run;                            /* End PROC step       */

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 Thursday, 25-Aug-2005 09:01:57 CDT