Sample 26008: Creating SAS generation data sets
You can keep multiple copies of a SAS data set by requesting the generations feature. The multiple copies represent versions of the same data set, which is archived each time it is replaced. Use the GENMAX= data set option to create historical copies of SAS data sets.
Note:
For more information on generation data sets, see the SAS Language Reference: Concepts.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
/* Create sample data using the GENMAX= data set option. In this */
/* sample there will be a maximum of 3 historical copies of PAYROLL. */
data payroll(genmax=3);
input lname : $15. salary;
datalines;
Huang 50000
Lindstrom 45000
Smith 560000
Jackson 100000
;
/* If running interactively, you can use the Explorer Window to view the */
/* PAYROLL data set(s). Each time the DATA step below is submitted, you */
/* will see another historical copy of PAYROLL up to a maximum of 3. */
data payroll;
set payroll;
salary=salary*1.03;
run;
/* Use the GENNUM= option to view a specific generation */
proc print data=payroll(gennum=0);
title 'Current version of PAYROLL';
run;
proc print data=payroll(gennum=1);
title 'Oldest historical version of PAYROLL';
run;
proc print data=payroll(gennum=2);
title 'Most recent historical version of PAYROLL';
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
Current version of PAYROLL
Obs lname salary
1 Huang 53045.0
2 Lindstrom 47740.5
3 Smith 594104.0
4 Jackson 106090.0
Oldest historical version of PAYROLL
Obs lname salary
1 Huang 50000
2 Lindstrom 45000
3 Smith 560000
4 Jackson 100000
Most recent historical version of PAYROLL
Obs lname salary
1 Huang 51500
2 Lindstrom 46350
3 Smith 576800
4 Jackson 103000
Use the GENMAX= data set option to create historical copies of SAS data sets.
| Date Modified: | 2007-11-01 16:18:49 |
| Date Created: | 2006-01-17 10:49:20 |
Operating System and Release Information
| SAS System | Base SAS | All | 8 TS M0 | n/a |