SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Replacing period in column name using PROC SQL

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Replacing period in column name using PROC SQL

[ Edited ]

Hello everyone,

 

I'm importing data from a database view using a proc SQL statement.  Unfortunately I have no power over column names, and quite a number of the column names include a period in the name (e.g. VARIABLE.NAME).  I know that SAS will automatically rename the variable name if it contains non-standard characters.  Is there some option that I can use where SAS will replace the "." in a column name with an underscore as well when creating the dataset?

 

Right now I'm looking at having to use string literal for all SAS variable names that include a period.  I'd rather not do that since I already have pre-created formats for correctly named SAS variables. Thank you!

 

PROC SQL;
CREATE TABLE RANDOM_NAME
AS SELECT * FROM Database.View;
QUIT;

 


Accepted Solutions
Solution
a month ago
Super User
Posts: 24,010

Re: Replacing period in column name using PROC SQL

options validvarname=v7;

If you have this option set, SAS should convert it to the appropriate names. 

 


@ssbxvm wrote:

Hello everyone,

 

I'm importing data from a database view using a proc SQL statement.  Unfortunately I have no power over column names, and quite a number of the column names include a period in the name (e.g. VARIABLE.NAME).  I know that SAS will automatically rename the variable name if it contains non-standard characters.  Is there some option that I can use where SAS will replace the "." in a column name with an underscore as well when creating the dataset?

 

Right now I'm looking at having to use string literal for all SAS variable names that include a period.  I'd rather not do that since I already have pre-created formats for correctly named SAS variables. Thank you!

 

PROC SQL;
CREATE TABLE RANDOM_NAME
AS SELECT * FROM Database.View;
QUIT;

 


 

View solution in original post


All Replies
Solution
a month ago
Super User
Posts: 24,010

Re: Replacing period in column name using PROC SQL

options validvarname=v7;

If you have this option set, SAS should convert it to the appropriate names. 

 


@ssbxvm wrote:

Hello everyone,

 

I'm importing data from a database view using a proc SQL statement.  Unfortunately I have no power over column names, and quite a number of the column names include a period in the name (e.g. VARIABLE.NAME).  I know that SAS will automatically rename the variable name if it contains non-standard characters.  Is there some option that I can use where SAS will replace the "." in a column name with an underscore as well when creating the dataset?

 

Right now I'm looking at having to use string literal for all SAS variable names that include a period.  I'd rather not do that since I already have pre-created formats for correctly named SAS variables. Thank you!

 

PROC SQL;
CREATE TABLE RANDOM_NAME
AS SELECT * FROM Database.View;
QUIT;

 


 

New Contributor
Posts: 2

Re: Replacing period in column name using PROC SQL

I knew it had to be something simple. Thank you!
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 238 views
  • 0 likes
  • 2 in conversation