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: Manitoba Health - Log 1
67 options linesize=min;
68
69 **==================================**
70 ** f=readmb.sas **
71 ** **
72 ** This program creates a temporary **
73 ** SAS data set from the simulated **
74 ** Manitoba Health data **
75 **==================================**;
76
77 /* Assign a name ("rawdata") to the path and file */
78
79 filename rawdata
80 'c:\My Documents\My SAS Files\sasmanual\data\fivet93m.raw';
81
82 /* Begin the DATA step */
83
84 DATA TEST; /* Create "test" data set */
85 INFILE RAWDATA; /* Read the external data */
86
87 /* Assign variable names, types & locations */
88 INPUT
89 NCASE $ 1-5
90 GENDER $ 6
91 AGE 7-9
92 LOS 10-13
93 NDAYICU 14-17
94 TRANADM $ 18
95 TRANDIS $ 19
96 OP01 $ 20-23 /* This is numeric 0 */
97 DIAG01 $ 24-28 /* This is numeric 0 */
98 DIAG02 $ 29-33 /* This is numeric 0 */
99 TOTCHAR 34-35
100 CHARYES $ 37
101 SCHEDULE $ 38
102 RISKDRG $ 39
103 @40 DRGWT 6.4 /* 6 columns, incl. 4 decimal*/
104 DRG $ 46-48
105 WBURG $ 49
106 DISCRE 50
107 REGIONRE $ 51
108 REGIONH $ 52
109 INCDR $ 53
110 TYPEHSP $ 54
111 DEATHSEP 55-58
112 DRGRGN $ 59-63
113 SEVERDRG $ 64
114 @65 RDRGWT 6.4
115 CMG $ 71-73
116 @74 RIW 7.4
117 TREATY $ 81
118 ABSTYPE $ 82
119 DAYSFRPR 83-85
120 DAYSTOR 86-88
121 @89 ICD17BRK $char2. /* Keep leading spaces */
122 ; /* End of INPUT statement*/
123 run;
NOTE: The infile RAWDATA is:
File Name=c:\My Documents\My SAS
Files\sasmanual\data\fivet93m.raw,
RECFM=V,LRECL=256
NOTE: 5000 records were read from the infile RAWDATA.
The minimum record length was 90.
The maximum record length was 90.
NOTE: The data set WORK.TEST has 5000 observations and 33
variables.
NOTE: DATA statement used:
real time 0.74 seconds
cpu time 0.65 seconds
123! /* End of DATA step */
124
125 /* Obtain general information about the data set */
126 proc contents data=test; /* Begin PROC step */
127 run;
NOTE: PROCEDURE CONTENTS used:
real time 0.15 seconds
cpu time 0.04 seconds
127! /* End PROC step */
128
129 /*Obtain values of all variables for the 1st 10 records*/
130
131 proc print data=test (obs=10); /* Begin PROC step */
132 run;
NOTE: PROCEDURE PRINT used:
real time 0.08 seconds
cpu time 0.04 seconds
132! /* 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
|