Add-Innovation Home

About Add-Innovation

Contact Us

  SAS Institute logo.    Rename rather than copy variables.


Another  dataset option which is frequently overlooked is the rename option. The area where it often becomes the most misused is when a version of the same data requires a different variable name, and a new variable is created which is a copy of the old one. For example, if a list of customer details is read and processed, and a format is to be created for later subsetting. Rather than creating a new variable called Start, renaming the old variable on the output dataset will be more efficient.

 e.g.

Data AccList(Keep=DistAcc Prodcode)
  Format(Drop=Prodcode Rename=(DistAcc=Start));
    Retain FMTName ‘@KEEPAC’ Label 1 HLO ‘ ‘;
Infile Inventory EOF=Label;
Input @15 ProdCode $6. @;
If Prodcode In (’A12345’,’A23456’,’A34567’);
Input @1  DistAcc $10.;
Return;
Label:DistAcc=’ ‘;
    Label=0;
    HLO=’O’;
    Output;