BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JCH_FEC
Calcite | Level 5

Hello, all.  I am new to SAS but trying to understand the program syntax of some legacy SAS files.  This has to do with the rename statement. 

The very first lines in the program file look like this:

data mysetname (rename =

                         field1name     = newfield1name

                         field2name     = newfield2name

                         field3name     = newfield3name

                         this repeats for every field in the table, about 25 fields.

When would/why would you rename every field in a table?  These are the very first lines in the program and the first data set.  It doesn't look like there's any data transforming or calculations going on, just the renaming of the fields.  A best practice method?  Whoever wrote it did this each time they were defining a new data set.

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Without documentation best guesses:

  1. to match conventions, e.g the variable name match the names in another data source
  2. To merge back in later with a similar dataset to avoid name duplications
  3. To standardize code for a macro or old code to run, that was expecting certain variable names in the data set.
  4. More understandable names, gpc2342 means very little, but general_practitioner_south means way more.
  5. Cause...:smileylaugh:

View solution in original post

3 REPLIES 3
Reeza
Super User

Without documentation best guesses:

  1. to match conventions, e.g the variable name match the names in another data source
  2. To merge back in later with a similar dataset to avoid name duplications
  3. To standardize code for a macro or old code to run, that was expecting certain variable names in the data set.
  4. More understandable names, gpc2342 means very little, but general_practitioner_south means way more.
  5. Cause...:smileylaugh:
Astounding
PROC Star

6. Because the boss said to do it that way.

7. Because the data is about to be downloaded to a spreadsheet and those are the column headings that the analyst wants.

ballardw
Super User

8. Didn't know how to use proc datasets to rename variables.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 908 views
  • 6 likes
  • 4 in conversation