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

         

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 2

Another version of the program that reads the simulated Manitoba Health data set adds the following two lines into the program, as shown below:

  • %include 'My Documents\My SAS Files\ sasmanual\ formats \fmts95.sas'; This file contains code to create label formats for many of the data values.
  • %include 'My Documents\My SAS Files\ sasmanual\ formats \lbls93.sas'; This file contains code to create labels for the variables of the data set, as well as a SAS statement to attach the above labeling formats to the data values.

Note that the user will need to modify the pathnames for such files to reflect their actual location on the user's system.

Note that 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 resulting log shows that formats have been output, or created. The Output window shows labeled variables in the CONTENTS output, and labeled values in the PRINT output (e.g., the variables gender and regionre).

options linesize=min;

**==================================**
** f=readmb2.sas                    **
**                                  **
** This program creates a temporary **
** SAS data set from the simulated  **
** Manitoba Health data             **
** and adds formats and labels.     **
**==================================**;

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

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


     /* Create formats that can be used to label values */
%include
'c:\My Documents\My SAS Files\sasmanual\formats\fmts95.sas';

                                /* 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*/

     /*Apply the formats to label the values */
     /*Also use LABEL statement to label the variables */
%include
'c:\My Documents\My SAS Files\sasmanual\formats\lbls93.sas';


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:47 CDT