Google SAS Search

Add to Google

Thursday, November 19, 2009

Keep and Rename Data Set Options

I always forget which gets applied first when using the keep= and rename= data set options on the same data set. So I thought I'd just put it here so I will remember:

Keep happens before the rename.

Keep happens before the rename.

Keep happens before the rename.

There. Now I won't forget.

A little test code to prove it:


data test;
length x y z $5;
run;

data test;
set test(keep=x y z rename=(x=x2));
run;

2 comments:

  1. I remember this based on the fact that SAS processes the dataset options in alphabetical order: DROP, KEEP, RENAME, WHERE.

    ReplyDelete
  2. @theorbo-- that's a great way to remember it!

    ReplyDelete