A regularly updated blog about programming with the SAS System.
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;
I remember this based on the fact that SAS processes the dataset options in alphabetical order: DROP, KEEP, RENAME, WHERE.
ReplyDelete@theorbo-- that's a great way to remember it!
ReplyDelete