BookmarkSubscribeRSS Feed
jeremy7
Calcite | Level 5

Hi,

How can I select column name with _ and space like name _category.

 

Is there any way in SAS that can standardize the column name ? 

2 REPLIES 2
Tom
Super User Tom
Super User

@jeremy7 wrote:

Hi,

How can I select column name with _ and space like name _category.

 

Is there any way in SAS that can standardize the column name ? 


To reference a name that does not follow normal rules you have to use a name literal 

'name _category'n

What is the SOURCE of the data that has names with spaces in them?

To allow SAS to use such names you have to have set the VALIDVARNAME option to ANY.

If the source was an Excel file or text file that you imported you could set the VALIDVARNAME back to V7 and then re-import the data.  PROC IMPORT should then convert those invalid names to something usable.  Perhaps name__category.

Reeza
Super User

Add this to the top of your code and re-run it.

options validvarname=v7;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 387 views
  • 1 like
  • 3 in conversation