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

Hi, i have an xls file from which records needs to be extracted for loading to DB table. SAS by default has provided an extraction script which uses XLS engine for importing the data. I require the column names in the excel to be renamed before the extraction script is run. Is there any sas code to rename the column on the file. Any pointers to this would be helpful

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

You have two possibilities:

- set options validvarname=v7; this will force proc import to create names that comply with SAS standards.

- or use (eg) 'Name of Individual or Entity'n as the variable name in the rename statement.

View solution in original post

4 REPLIES 4
Anand6666
Calcite | Level 5

Thanks Kurt for the update, got a lead to explore. After importing the excel data into sas dataset, i tried the renaming option but column name contains space between it instead of '_' hence causing the code to fail.

Error: Expecting an =.

 

is there any way i can rename the column - Name type -> Name_type.

Have attached a screenshot of the column name for reference.

Kurt_Bremser
Super User

You have two possibilities:

- set options validvarname=v7; this will force proc import to create names that comply with SAS standards.

- or use (eg) 'Name of Individual or Entity'n as the variable name in the rename statement.

Anand6666
Calcite | Level 5

Thanks a ton Kurt for the quick response . I tried both approaches and both worked fine .

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 5287 views
  • 1 like
  • 2 in conversation