Chapter Contents

Previous

Next
SAS/CONNECT User's Guide

Example 4. DTS: Transferring Generations of SAS Data Sets


Purpose

Generation data sets are historical versions of SAS data sets, SAS views, and SAS/ACCESS files. They enable you to keep a historical record of the changes that you make to these files. There are two data set options that are useful when manipulating generations of SAS data sets: maximum number of generations (GENMAX) and generation number (GENNUM). GENMAX indicates how many generations to keep, and GENNUM is used to access a specific version of a generation group.

SAS/CONNECT transfers generations of SAS data sets by default during library transfers. The base data set, as well as all of its historical versions, are transferred.

If the user does not want all generations to be transfered, single data set transfers should be used. With single data set transfers, only the specified data set is transferred.


Programs


Example 4.1: Using LIBRARY Transfers to Transfer Data Set Generations

This example transfers the local data set LOCAL.SALES as well as its generations to the remote library REMOTE. If the data set SALES already exists in the output library, the base and all existing generations will be deleted and replaced by those that are uploaded.

data local.sales(genmax=3);
   input store sales95 sales96 sales97;
   datalines;
  1   221325.85   214664.02   212644.60
  2   134511.96   159369.47   317808.48
  3   321662.42   244789.33   236782.59
 ; 
run;

data local.sales;
   input store sales95 sales96 sales97;
   datalines;
  1   251325.25   217662.16   222614.60
  2   144512.11   179369.47   327808.48
  3   329682.43   249989.93   256782.59
 ; 
run;

data local.sales;
   input store sales95 sales96 sales97;
   datalines;
  1   261325.33   218862.16   222614.60
  2   145012.11   189339.47   328708.71
  3   330682.46   259919.92   258722.52
 ; 
run;

   /* PROC DATASETS will show that the   */
   /* base data set as well as two       */
   /* generations exist in the library.  */
proc datasets lib=local; 
quit;

rsubmit;
   proc upload in=local out=remote cstatus=no;
   run;
endrsubmit;


Example 4.2: Using a SELECT Statement to Transfer Generations

Specific generations cannot be specified in the SELECT or the EXCLUDE statements for library transfers. When the SELECT statement is specified for the library transfer, the selected base data set as well as all of its historical versions will be transferred. Similarly, when the EXCLUDE statement is specified for the library transfer, the selected base data set as well as all of its historical versions will be excluded from the transfer.

In the following example, the data set LOCAL.SALES as well as all of its generations will be uploaded.

rsubmit;
   proc upload in=local out=remote cstatus=no;
      select sales (mt=data);
   run;
endrsubmit;


Example 4.3: Inheriting Generation Specific Attributes

During library transfers and single data set transfers when OUT= is not specified, data set attributes are inherited in the output data set. In Version 7 or Version 8, the maximum number of generations will be a new inherited attribute. In addition, the next generation number attribute is inherited ONLY when a library transfer occurs. This attribute is only inherited when the generations are actually transferred, and therefore it is NOT inherited for any single data set transfers. In the following example, both the maximum number of generations and the next generation number attributes are inherited in the output data set because this is a library transfer.

rsubmit;
   proc download in=remote out=local;
      select sales(mt=data);
   run;
endrsubmit;

In the following example, only the maximum number of generations attribute is inherited. The next generation number attribute is not inherited because this is a single data set transfer, and therefore no generations are transferred.

rsubmit;
   proc download data=remote.sales;
   run;
endrsubmit;


Example 4.4: Transferring Single Data Sets

A specific generation can be transferred by specifying the GENNUM= data set option for a single data set transfer. In the following example, a specific historical version is updated by specifying GENNUM=1.

rsubmit;
   proc upload data=local.sales(gennum=1);
   run;
endrsubmit;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.