BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BarryP
Quartz | Level 8

Hi, 

I'm using Enterprise Guide 7.1 (16 bit) and would like to change VARIABLE_NAME to VARIABLE NAME.

The reason is that I have reports in Visual Analytics that are using tables imported from Excel.  I'm currently trying to replace the Excel tables with tables created in SAS.  

 

Right now I'm expecting that I'm going to have to use underscores and then manually point all of the new variables to the tables in those reports that currently use variables with spaces.  I'd like to avoid this if possible.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
BarryP
Quartz | Level 8

Okay, I have it figured out.  It was pretty simple.  I was missing a semicolon and thought I was having a syntax issue.

Code: 

 

Rename VARIABLE_NAME = 'VARIABLE NAME'n;


As stated in the replies, this is not good practice.  However, my SAS Visual Analytics dashboard is already utilizing variable names with spaces, and it'll be too much work to go through the effort of renaming all of them in the dashboard.

I plan to do this as a final step in my code in order to rename all of the variables to match the tables already used in my dashboards so that I can replace them seamlessly.

 

Thanks!

View solution in original post

7 REPLIES 7
Astounding
PROC Star

Yes, you can, but .....

 

From that point forward you will have to refer to the variable as "Variable Name"n.  That's a little clumsy.  Is it worth the effort?

PaigeMiller
Diamond | Level 26

Agreeing with @Astounding, and adding that you want to use labels in the case where you need a "nice" appearance to your results, you don't want variable names to be used for that purpose.

--
Paige Miller
BarryP
Quartz | Level 8

Thanks Paige.  If I under understand things correctly, labels would only effect a SAS output like proc print, or some other way to maybe look at a report through Web Report Studio.  Instead I'm viewing everything in SAS Visual Analytics, which would, I *think* be reading the variable names, not the labels.  

In the future when I'm doing more and more SAS coding, I believe it makes sense to use variables without spaces and then later rename then in SAS VA rather than in the code.

 

 

BarryP
Quartz | Level 8

I was thinking of doing it on as a final step.

ie  Write my code, and then before the final output table change the variable names where needed.  This will save me probably a day of work on my dashboards.

 

So how do I rename them?

Kurt_Bremser
Super User

@BarryP wrote:

I was thinking of doing it on as a final step.

ie  Write my code, and then before the final output table change the variable names where needed.  This will save me probably a day of work on my dashboards.

 

So how do I rename them?


rename name_with_underlines = 'name without underlines'n;

Similar for the rename dataset option.

BarryP
Quartz | Level 8

Okay, I have it figured out.  It was pretty simple.  I was missing a semicolon and thought I was having a syntax issue.

Code: 

 

Rename VARIABLE_NAME = 'VARIABLE NAME'n;


As stated in the replies, this is not good practice.  However, my SAS Visual Analytics dashboard is already utilizing variable names with spaces, and it'll be too much work to go through the effort of renaming all of them in the dashboard.

I plan to do this as a final step in my code in order to rename all of the variables to match the tables already used in my dashboards so that I can replace them seamlessly.

 

Thanks!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 3954 views
  • 2 likes
  • 4 in conversation