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
|
Saving Space In SAS
The following is a list of things to check, or think about when writing SAS
programs, especially if you are working on large data sets.
- Keep only the variables you need in the data
step using the keep option on the set statement.
data temp ;
set cpe.hsp9192 (keep=phin91 transact los);
.... more code .....
run;
- Keep only the variables you need in the output data using a keep,
or drop on the data statement.
data temp(drop=age dx01-dx16) ;
set cpe.hsp9192 ;
.... more code ....
run;
- Sub-set only the observations you require. Do the largest possible
sub-setting of data using a where command on the set statement.
data temp ;
set cpe.hsp9192(keep=phin91 transact los
where=(transact='1')) ;
.... more code .....
run;
- Minimize the length of any variables you generate using the
length statement.
data temp ;
length grouper $1 ;
set temp ;
grouper = put(diag,$groupf.) ;
run;
- Re-use data set names within the same program, or use proc data sets
with the delete command to remove un-used data sets.
- On large, multi-variable (20+) data sets use the SAS compress
option.
WARNING: Some times this can create even larger data sets.
- Encode variables in their most efficient form. e.g. use a single character
variable, and a format for labels.
- If necessary compress your data sets with the Unix compress
or zip options. It is possible to use unix compressed data sets
on the fly from within SAS (75-90% space saved).
The above tips come from: SAS Programming Tips: A
Guide to Efficient SAS Processing.
|
Contact: Charles Burchill
Telephone: (204) 789-3429
Systems Analyst,
Manitoba Centre for Health Policy and Evaluation
Department of Community Health Sciences,
University of Manitoba
T155 Old Basic Sci Bldg
Winnipeg, Manitoba
R3E 0W3
Fax: (204) 789-3910
|