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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 4 replies
  • 4608 views
  • 1 like
  • 2 in conversation