BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
AmrAd
Obsidian | Level 7

i am trying to import bulk of files and create one dataset having all these files ,i am facing a problem that variable name is greater than 32 character and sas is not accepting this accordingly sas renames the header to serial as Name 1 name 2 .etc

i need to capture original header name to be able to append all the tables in one table 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

As long as you use Excel files, and have names in there which exceed the limits of SAS, you will have problems.

  • either use valid names (up to 32 characters, containing only letters, digits or underlines, do not start with a digit) in the spreadsheets
  • or save the files as text files (csv), which you can read with a DATA step you write, giving you full control over variable names and attributes (discard the header line with FIRSTOBS=2 in the INFILE statement)

The second option is preferred for repeatable, consistent results.

View solution in original post

5 REPLIES 5
JosvanderVelden
SAS Super FREQ
What file types will you import? ex. csv, xls, xlsx, delimited... Which encoding do these files have? ex. ANSI, UTF8 ... The header with varnames is a single line/row with less then 32676 characters?
AmrAd
Obsidian | Level 7

Hi Josvander

i am trying to import XLSX file with UTF8 encoding

 

Kurt_Bremser
Super User

As long as you use Excel files, and have names in there which exceed the limits of SAS, you will have problems.

  • either use valid names (up to 32 characters, containing only letters, digits or underlines, do not start with a digit) in the spreadsheets
  • or save the files as text files (csv), which you can read with a DATA step you write, giving you full control over variable names and attributes (discard the header line with FIRSTOBS=2 in the INFILE statement)

The second option is preferred for repeatable, consistent results.

AmrAd
Obsidian | Level 7
The header with varnames is a single line/row with less then 32676 characters?

yes

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 5 replies
  • 1542 views
  • 3 likes
  • 3 in conversation