proc sql;
alter table students rename column Sex to Gender;
quit;here it shows error
What does the error say? Are you sure you want to rename the variables like this?
Maxim 1: Read the Documentation.
ALTER TABLE in SQL. There is no RENAME clause for this SQL statement.
To rename columns, use the RENAME statement or the RENAME= dataset option in data steps, or do a SELECT with AS in SQL.
If you don't want to rewrite he dataset with the new column name, but do it inplace - you can use
proc datasets lib=<librray> nolist;
modify <dataset name>;
rename <current name> = <new name>;
quit;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
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.
Ready to level-up your skills? Choose your own adventure.