- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Renaming a column
I am trying to rename a column using the following script but it does not work, can anyone tell me what is wrong with this script? are there better ways to rename columns?
col2 = Column(2);
col2 = Set Name ("XYZ");
Thanks.
col2 = Column(2);
col2 = Set Name ("XYZ");
Thanks.
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Renaming a column
You're close. Try this instead:
col2 = Column(2);
col2 << Set Name ("XYZ");
col2 = Column(2);
col2 << Set Name ("XYZ");
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Renaming a column
You're close. Try this instead:
col2 = Column(2);
col2 << Set Name ("XYZ");
col2 = Column(2);
col2 << Set Name ("XYZ");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Renaming a column
Thanks....that works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Renaming a column
You can also use munger to change part of the name of a column. This is useful after "tabulate" or "summary" specially if you iterate through the different variables.
eg one variable
column(data_table,2)<<set name(munger(munger(eval(char(column(data_table,2))),1,"Column(\!"text_that_you_want_to_change ",""),1,")\!")",""));
eg all variables
for(i=1,i<=n col(data_table),i++,
column(data_table,i)<<set name(munger(munger(eval(char(column(data_table,i))),1,"Column(\!"text_that_you_want_to_change ",""),1,")\!")","")));