SAS Macro: rename all variables in a data set

16 March 2011

Here is a SAS Macro to rename all variables in a data set. This macro was adapted from WENSUI’S BLOG IN STATISTICAL COMPUTING.

You can add a prefix, a suffix or both to variable names and you can either keep the same data set with the new variable names or create a new one.

Download: SAS Macro Rename 3.0.sas

Any improvement of this macro is very welcome.

How to use Rename macro:

%Rename(
Dataset : name of the data set
Out= : name of the new data set; if left blank no new data set is created
Prefix= : string that is added as prefix; if left bank, no prefix is added
Suffix= : string that is added as sufffix; if left bank, no suffix is added

If you have any problems to upload or to open it, send me an email.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.