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.

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 618 views
  • 0 likes
  • 2 in conversation