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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.