BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

I want to rename columns in data set ttt by  using help data set that tell for each column name what will be the new column name

Data ttt;
Input F1 F2 F3 $ F4 F5 F6 $;
cards;
1 2 Judy 4 5 Halifax 
;
run;

Data New_Names;
Input oldName $ NewName $;
Cards;
F1 ID
F2 age
F3 name
F4 height
F5 weight
F6 bank
;
Run;
1 REPLY 1
ballardw
Super User
data _null_;
   set new_names end=last;
   if _n_=1 then do;
      call execute("proc datasets library=work;
      modify ttt;
      rename");
   end;
   call execute (oldname||'='||newname);
   if last then call execute(';quit;');
run;
   

You may want to consider searching the forum. This sort of question has been asked and answered a number of times.

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 565 views
  • 0 likes
  • 2 in conversation