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

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 5 replies
  • 172 views
  • 3 likes
  • 3 in conversation