- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I ran into a problem that took a long time to debug. I renamed a variable so that it would contain spaces when displayed in SASVA. I know that there are other ways to do this, but I needed to keep the variable names consistent with data that was previously uploaded in Excel.
This does not seem to happen all the time (though I could be wrong). I would just like to understand when I can expect this to happen and why.
Data New_Table;
Set Old_Table;
Rename Variable_Name = 'Variable Name'n;
Run;
Results: Appears as Variable Name in my output, but when I hover over the column header, it shows that I have a label that is Variable_Name.
When this goes to SASVA, it appears as Variable_Name but when I hover over (or maybe right click) it lists the source variable as Variable Name.
FWIW, I fixed it by creating a new variable, making it = to the old variable, and then dropping the old variable.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
if you do not create a label for a variable SAS deflates to naming the labels with the variable name.
when you rename a variable only the variable name is changed and the old label is inherited.
to get what you are expecting use a label statement to label that variable to what you want it to display.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Why would SAS change the label if all you did was change the name?
You could set the new label.
data New_Table;
set Old_Table;
rename Variable_Name = 'Variable Name'n;
label Variable_Name = 'Variable Name';
run;
Or perhaps just remove the old one.
data New_Table;
set Old_Table;
rename Variable_Name = 'Variable Name'n;
label Variable_Name = ' ';
run;